Copy link to clipboard
Copied
Hello,
Illustrator Artboards and Layers are unrelated. Is there a way to find out the layers contained within an Artboard?
Thanks!
Copy link to clipboard
Copied
No, because as you point out -- layers & artboards are unrelated
Layers cover the entire canvas, while artboards are sections of the canvas. Nothing stops art from being on one layer but multiple (or no) artboards. So the question doesn't have a meaningful answer. Perhaps you're looking for "Is there a way to tell what art is contained within an artboard?"
Copy link to clipboard
Copied
Thats exactly what I am looking for. Thanks for reframing the question
So is that possible?
Copy link to clipboard
Copied
Possible, but only by doing it yourself it looks like. I just double-checked the API, and there's nothing in there. I suspect Adobe has something that would work, but if they do it hasn't been shared in the API unfortunately, at least as of CS6
Copy link to clipboard
Copied
Illustrator is different than Pages or spread in Indesign where layers are based on the spread.
You can do it but it is a manual job!
I do it all the time to make sure some of my layers are based on Artboard.
(It is almost like in PS but here you have a choice...)
Here are some screenshots...see the layers and Artbord have same name but I moved it manually
Copy link to clipboard
Copied
The project I'm working on right now involves a lot of this. I've coded most of the critical bits myself, as I haven't found anything in the SDK that does it natively.
Some of the key pieces I've identified:
• Cycle through all the arts
• Determine if the art is visible
• Determine whether each art is contained within the AIRect of an artboard
• Check whether the art is hidden due to being clipped, or if the visible area of a clipped art is within the AIRect of an artboard
• Determine which artboard an art is closest to
Bear in mind if an art is placed in certain spots, it may be on multiple artboards, or none.