Groups inside compound paths lead to problems
Today I'm going to bring you awareness to the way Illustrator treats groups in compounds.
For me it sounds strange already — why would I want a group inside of a compound path?
What would I use it for?
Ai won’t allow me to go isolate this group to edit its components.
Ai would not show it in the Layers tree — for some reason we can’t expand a compound path to see its children, like we can do with the groups.
Ai won’t give scripts a way to see these groups inside of compound paths — and this leads to problems when you have to cycle through a path’s children.
Still, Ai allows to create groups in compounds.
The very first option, when you select a group and command Create Compound Path, is fixed — Illustrator ungroups it for us, it seems, and then creates a compound path — if you uncompound it, you would get objects ungrouped.
The second one is simple as that, but is not fixed.
Create a new compound path from two or more objects. Leave it.
Create a new group from whatever number objects. Cut it.
Isolate the first compound path. Paste the group in the compound path.
There you have it, a group in a compound path.
A script won’t see its children when because AI never tells it is a group and not just a first level child.
If you uncompound it, the group will be there.
You don’t have to isolate and paste to create these.
Ai just makes them occasionally.
Draw two rectangles, one atop another.
Select them both and grab Shape Builder.
Click the inner rectangle once and then click one more time, but with Alt held.
And now you have a compound path that is comprised from a group entirely.
So the problem is that Ai can’t treat these uniformly. It says both yes and no:
— Ai doesn't allow to naively create compounds from groups — no
— You can paste groups inside — yes
— You can't expand compounds in Layers tree or isolate them — no
— You can have these done with default tools — yes
— But scripts won't see them — no
Guess, dear user!
Please make this more predictable.
Make these legal and give tools to control OR make the impossible entirely and make sure they stay like it.
Which way to choose?
Which one you prefer and why?
Let’s discuss it.
-
m1b commented
> Would you mind me merging these?
Sure go for it. Thanks!
-
Yep, it should.
By the way, Mark. This rather small entry seems to be a copy of a larger general cry I made in 2020: http://illustrator.uservoice.com/forums/601447/suggestions/41110042
Would you mind me merging these? -
m1b commented
By the way, I would expect Illustrator to automatically sanitise the path items before creating the compoundPathItem, rather than learn to handle bad compoundPathItems, such as those containing groupItems.
-
Here is another discussion of the problem:
https://stackoverflow.com/questions/19458141/illustrator-grouped-objects-inside-of-a-compound-path -
m1b commented
AI version: 27.1.1
OS: MacOS 13.1Steps to reproduce:
1. New Document.
2. Make some compoundPathItems (eg. create outlines of text).
3. Group the compoundPathItems.
4. Select that group
5. Choose menu: Object > Compound Path > Make
6. Run this script:
alert('pathItems.length = ' + app.activeDocument.selection[0].pathItems.length);Result: alert says pathItems.length = 0
Expected result: should say the actual number of pathItems -
Monika Gause commented
This can cause wrong results (strokes appear out of nowhere) when converting files for uses in CAD.
-
Leads to problems like this https://illustrator.uservoice.com/forums/601447/suggestions/44390481
-
Digidea commented
1. Open the attached file
2. Select all
3. Menu [Object - Compound Path - Make]Can be observed: The object on the right was a Group, but it has not been ungrouped when making Compound Path, and now it can never be ungrouped.
Now the Ungroup item in the menu can be clicked, but it has no effect.
And object on the right cannot be accessed by jsx script now, because compoundPathItem has no groupItems property.
Illustrator 26.0.1 (64-bit), Windows 10 19043.1288 x64
-
I also offered AstuteGraphics to solve this problem with their VectorFisrtAid plugin, and they did it in A DAY.
Now it would be able to detect groups inside compound paths and fix them.
It does not mean that Illustrator team should not fix it, on the contrary.
Please vote for this, if you are agree. -
Anonymous commented
It is possible to have a group inside a compound path. In the UI you will see "ungroup" offered but not working - the proper cure is to revert compound, then to ungroup, then to compound again.
In scripting, the compoundpath object simply has no path members (and the object does not provide access to groups)
Please either ensure that compound paths cannot include groups (preferred) or allow access to them from scripting