-
1. Re: How to delete a path item from within a group item?
Muppet Mark Jul 22, 2014 3:07 AM (in response to bcrimmins)I can't help you using VB ( I'm on a mac ) but in answer to your question… Yes its pretty straight forward…
Have script look for the path that has the clipping property as true…
In the case of your codes its most probably the first and only one in the group…
Do you mind using JS or do you need to do other processing in the VB…?
-
2. Re: How to delete a path item from within a group item?
bcrimmins Jul 22, 2014 8:26 AM (in response to Muppet Mark)Thanks, Mark. That makes sense. However, when I search all the paths in the document there are none that have a true clipping property. My suspicion is that the bounding square is just that, a square drawn by the qr code api as a frame around the code. You got me thinking though. I figured out that I can identify the relevant path simply by it's dimensions and then delete it. So here's the new sticking point: I don't think the Illustrator object model allows for interrogating path items within a group, i.e., you have to iterate through all the pathitems in the document. Ideailly, I'd like to be able to look at only the paths within the QR code, which I add to the document as a placed item... which Illustrator treats as a group. This document has tens of thousands of paths and so looping through all of the them to find the 50 QR codes would be super inefficient. What do you think? Is there a way to iterate through just the paths in a placeditem/group?
RE VB vs. JS, I can write in both but there are a lot of reasons I'm using VB on this project. The main reasons are that the customer is using Excel for data internally and Excel VBA is a really strong VBA object model. I've also written more than 500,000 lines of the stuff in my career so I'm pretty comfortable solving complex problems with it. Also, the IDE and the run-time debugging engine is oh so great for rooting out the nasties. :-)
-
3. Re: How to delete a path item from within a group item?
Larry G. Schneider Jul 22, 2014 9:03 AM (in response to bcrimmins)Since a GroupItem is a subclass of PathItem, it should be as simple as docRef.pathItems.groupItems(1)pathItems(1).
-
4. Re: How to delete a path item from within a group item?
Muppet Mark Jul 22, 2014 9:07 AM (in response to bcrimmins)#target illustrator
var doc = app.activeDocument;
alert( doc.pathItems.length ); // All document paths
alert( doc.groupItems[0].pathItems.length ); // Just the target group paths
alert( doc.pathItems.length - doc.groupItems[0].pathItems.length ); // The rest…
var count = doc.groupItems[0].pathItems.length;
for ( var i = 0; i < count; i++ ) {
doc.selection = doc.groupItems[0].pathItems[i];
$.sleep( 500 );
app.redraw();
};
Just target the required groupItem…? As you can see from this you can isolate any objects within the doc… Should be exactly the same in VB…?
-
5. Re: How to delete a path item from within a group item?
bcrimmins Jul 22, 2014 11:41 AM (in response to bcrimmins)Gentlemen, thanks for the ideas. You stimulated the following solution:
myPlacedItem.Layer.GroupItems(1).PathItems(1).Delete
I couldn't get to the GroupItems or PathItems directly through the PlacedItem object, but once I dove into the layer property... voila!
Thanks for your help!
Bob


