the user selects compoments with a box selection or shift click on the tree: I am looking for a way to exclude the component that are from sub assemblies or subassemblies from the selection array.
i.e. only the component parts under the currently open assembly are allowed.
this is required for e.g. a component mirror and in the UI a warning message is displayed cancelling the command. I would like to automatically discard the wrong components.
how to eliminate subassemblies and their components from selection
Re: how to eliminate subassemblies and their components from selection
Just check each component's parent to make sure it's null. If not, or selection is not a component, de-select.
Sorry, not reall code. But something like this
Sorry, not reall code. But something like this
Code: Select all
for i = selmgr.getselectedobjectounc(-1) to 1 step -1
if selmgr.selobjtype = component thne
if not (component.getparent is nothing) then
selmgr.deselect2(i,-1)
end if
else
selmgr.deselect2(i,-1)
end if
next