I have a layer that contains two clipping groups (groups with a clip mask and other art). When I call layer.groupItems it returns an empty array. When I call layer.layers it returns the two clipping groups. I need to know if these layers are clipping groups, but if they are coming back as layers how can I figure that out?
That won't pass a syntax check with those colons… What happens if you try this… Change my fluff for any name you like ( that's present in doc )…
#target illustrator var doc = app.activeDocument; var sourceLayer = doc.layers.getByName( 'fluff' ); var layPageItems = sourceLayer.pageItems; var layGroupItems = sourceLayer.groupItems; var layLayers = sourceLayer.layers;
I don't really know what I can add… I quickly made a doc that looks like your structure and slighty modified the above snippet to debug…
All the results are exactly what I would expect? Is you dupe layer question also ActionScript?
#target illustrator var doc = app.activeDocument; var sourceLayer = doc.layers.getByName( 'Layer 1' ); $.writeln( sourceLayer.pageItems.length ); // returns 3 $.writeln( sourceLayer.groupItems.length ); // returns 2 $.writeln( sourceLayer.layers.length ); // returns 0
I'm just not getting warm fuzzies over this api. It seems very broken. I would expect the results you are getting, but why my results are different baffles me.
The dupe layer question is also ActionScript, but after perusing these forums it seems it's a known issue that z-ordering is broken in this api. There is no way to reliably get the correct z-order for elements in a layer.
Thank you Mark for your responses.
Europe, Middle East and Africa