I have an assembly with many components and sub-components. I built a selection set of the ones I want to keep visible. I want to invert selection and hide the rest. Default "invert selection" doesn't seem to work, no matter what filter options I choose. I'd like to write a script that does the invert I'm looking for (select all components at all levels of the document tree except those in the original selection set). Is this straightforward? In the API reference I see where everything is located in the hierarchy except sub-components.
Thank you!
Hi Mr. I-Make-Robots,
Components can not be selected only occurrences can.
However, all design's components can be found.
The task you described is not difficult:
- find all occurrences in your design - occLst = rootComponent.allOccurrences
- for tasks other then selection component list might be useful - compLast = design.allComponents
- iterate through occLst (or compLst) list excluding elements you do not want
- perform the action of your choice on the rest
Regards
MichaelT
Can't find what you're looking for? Ask the community or share your knowledge.