Compound Shape mess

2 min readMay 9, 2023

Compound Shape belongs to the PluginItem type because it is created in Illustrator by the Pathfinder plug-in. The PluginItem’s position attribute sets the position of the top left corner of the object, just like the similar attribute for other objects. An alternative method of setting the position is to use the left and top attributes. The translate(x, y) method is also used to move objects along the X, Y axes. Consider an example of moving a Compound Shape.

Compound Shape created from three ellipses with Alt pressed

Both changing object coordinates via attribute and moving via method worked as usual. An unobvious bug is detected when there is a group among the elements of a Compound Shape.

A similar problem occurs when you try to change the position with the left and top attributes

In a Compound Shape like this, all nested groups remain in place, only the individual elements of the shape are moved. To accurately move all nested objects without knowing if any are inside the group, you would have to use the cumbersome method described in the “Access to Compound Shape” post.

var prnt = getTopParent(selection[0]);
for (var i = 0; i < prnt.pageItems.length; i++) {
prnt.pageItems[i].translate(50, 0);
function getTopParent(item) {
if (item.parent.typename !== "PluginItem") {
return getTopParent(item.parent);
} else {
return item;
To access the contents of the Compound Shape from within the script, you must select the inner element




Sergey Osokin. Product Illustrator, Icon Designer, Script Developer (Ai, Ps). Writing about bugs and tricks in Adobe Illustrator scripts