Copy link to clipboard
Copied
I'm looking for script or code to loop through a pluginItem. The item is being generated when you use 2 paths or compound shapes and then use subtract while holding alt in the Pathfinder options. Second icon on the top left in the panel. This items is sort of a live boolean, we can still move the paths.
If I try to use selection.length to t returns 1. I can't seem to fine code how to access the children items or sub items
Copy link to clipboard
Copied
Hi @schroef, unfortunately I think the answer is that Illustrator's scripting API does not give us access to path items of a pathfinder PluginItem. I wondered if there was an "executeMenuCommand" to release the pathfinder but I couldn't find that either. I hope someone else has better news for you.
- Mark
Copy link to clipboard
Copied
I've been looks jg at some threads but also have not find anything usefull. The issue is that a pluginItem can be different things. So I'm not sure how I can get access to some props telling ng more about the pluginItem object. The scripts ng reference doesn't show much about a pluginItem.
Perhaps I should try to group and then expand it. Then check if the items are either pathItem or compundPathItem. Then I can continue with the script to check for its area.
Though this will destroy the original object. So I guess I need to duplicate it first and then run the script on that duplicate.
Other issue will be that a live traced object, I believe, will also return type ame as pluginItem. So that object will/can cause se issues.
My script needs to get the area of a shape. That's what I'm looking for. Perhaps I just need to test .area on that pluginItem. Now thinking about it, I haven't actually tried thay yet
Copy link to clipboard
Copied
It may help to know that compound shape can be released with an action, and that it can be retrieved with a selection when only its contents are selected.
Copy link to clipboard
Copied
Nice! I always forget about actions.
Copy link to clipboard
Copied
True, i guess, but in my case i need the area if this object. I think my solution for now is to duplicate it, then applyStyle and then check if its pathItem or compoundPathItem and then see if i can get the area.
Im expanding a nice script from Bryan Buchanan; https://gist.github.com/bryanbuchanan/11387501
Ive already added an interface and some more options. I just wanted to try if i can add more objects which it can handle