Skip to main content
Inspiring
November 16, 2024
Question

Why does the illustrator find an extra group?

  • November 16, 2024
  • 1 reply
  • 392 views

 

You see a group that consists of: on the left is a regular rectangle, on the right is a clipping mask, in which the mask is the same rectangle as on the left, and inside the mask are three rectangles (squares): white, above it orange, and above the orange white with a blue border. Simple, right?
The question is equally simple, how many groups are there from a scripting perspective? It would seem that the general group and the clipping group are just two groups. But Illustrator finds three groups.

Let's simplify and ungroup the outer group. Now we have two separate objects: a rectangle on the left and a clipping mask (group) on the right. So there's one group, and Illustrator will agree with us on that.

Question: where does the third group come from in the first case?

This topic has been closed for replies.

1 reply

m1b
Community Expert
Community Expert
November 16, 2024

Hi @andyf65867865, I cannot reproduce this. At your first step I get 3 groupItems, same as you. But after ungrouping the outer group I get 2 groupItems (the clipping group and the clipped group). How are you measuring the groupItems' count? I'm using doc.groupItems.length.

 

Edit: to answer your question: where does the third group come from in the first case? You made two groups (the outer group and the group inside the clipping group) and the extra group is the clipping group—that's just how clipping masks work in Illustrator.

 

- Mark

Inspiring
November 16, 2024

Hi @m1b I used a recursive function that counted the groups differently than the method you cited - obviously this is the reason for the difference in counts. But maybe you meant: "the extra group is the clipped group". 

m1b
Community Expert
Community Expert
November 16, 2024

Oh I see. I thought there was a group inside the clipping group. In that case the reason for your 3 count was an incorrect function. My count is 2—the outer group and the clipping group. When I ungroup the outer group, the count is 1.