You'll typically need to do some kind of recursive traversal of the instances (if you need to visit every instance) or instanceMasters (if going to each master once is sufficient). Assuming you want to visit just each master once, something like:
Code:procedure(EXtraverseHierarchy(cellView @optional (doneSoFar makeTable('visited nil)))
let((rects)
foreach(master cellView~>instanceMasters
unless(doneSoFar[master]
doneSoFar[master]=t
EXtraverseHierarchy(master doneSoFar)
)
)
rects=setof(shape cv~>shapes shape~>objType=="rect")
; do whatever you were going to do with the rects
)
)
Sorry if the formatting is not as neat as I would do usually - I just typed this in off the top of my head using a proportional font, so it's a little hard to make it all line up... (actually by the time I'd written that explanation, I could have done it!).
Best Regards,
Andrew.