Page 1 of 1

how to eliminate subassemblies and their components from selection

Posted: Fri Sep 29, 2023 6:54 am
by mp3-250
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.

Re: how to eliminate subassemblies and their components from selection

Posted: Fri Sep 29, 2023 1:24 pm
by josh
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

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