Selecting outermost path

I can think of lots of inelegant ways to access the outermost path of a glyph with many nested paths via scripting, but is there an elegant way?

If you can rely on it beingthe first path (as it should), it is simply:


If you can rely on it being the one with the largest bounding box (should always be true, right?):

largestBBox = 0
outermostPath = None

for path in Layer.paths:
    size = path.bounds.size
    bbox = size.height * size.width
    if bbox > largestBBox:
        largestBBox = bbox
        outermostPath = path

if outermostPath:
    for node in outermostPath.nodes:
1 Like


I would iterate all path/node and get the node with the smaller x value. That path has to be an outermost.

Does the lowest path when drawn automatically slot in at the paths[0] spot?
If not,would a correctPathDirection() fix it, and thus be useful before Layer.paths[0]?