Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

adding multiple paths into a compound path

$
0
0

If I use the gui to add multiple paths into a compound path all I have to do is select multiple paths and choose Object->Compound Path->Make (or ctrl-8). When I do this then the bottom path which is filled has holes 'punched through' creating a window in the shape of the smaller paths which were on top of the larger one. For example, a large rectangle with a white fill color is the bottom item and two smaller paths are on top. I create a compound path and whatever is below the new compound path shows through in the largest shape of the previous two smaller paths.

 

If I use JavaScript and create a new compoundPathItem and move 3 paths into it, with the largest being first, then I get a compound path but only the first of the smaller objects creates a transparent space.

 

Here is a simplified example:

 

    var grpMask = doc.groupItems['mask group'];
   
    var compound = grpMask.compoundPathItems.add();
    var pathobj = grpMask.pathItems['bigbox'];
    pathobj.move(compound,ElementPlacement.INSIDE);
    pathobj = grpMask.pathItems['PathLeft'];
    pathobj.move(compound,ElementPlacement.INSIDE);


    pathobj = grpMask.pathItems['PathRight'];
    pathobj.move(compound,ElementPlacement.INSIDE);

 

 

In the above example the 'bigbox' path has the left and right paths on top of it but only the left path creates a transparent space in the original box.

 

I also tried using PLACEATEND instead of INSIDE and grouping the two smaller paths together and moving the group to the compound path.

 

Merging path items together won't work - I want to keep the original path's closed and intact without drawing a line between them so I can't just add their pathpoints together.

 

Is move() the best way to add existing paths to a new compound path?

 

Thanks!


Viewing all articles
Browse latest Browse all 12845

Latest Images

Trending Articles



Latest Images