Python SpaceClaim API: Setting object visibility from selection

sterlingbutters
sterlingbutters Member Posts: 1 **
edited June 2023 in 3D Design

Greetings,

I am trying to "check the box" for a number of parts in the structure tree. Using the recording feature of the API, I get the ViewHelper.SetObjectVisibility class/method. Trying to apply this to my existing selection yields nothing though - code below. How can I toggle the parts based on my existing selection?

select_bodies = []

for i_body in GetRootPart()GetComponents():

  if i_body.GetName().Equals(""):

    select_bodies.append(i_body)

 

# Change Object Visibility

selection = Selection.Create(select_bodies)

visibility = VisibilityType.Show

inSelectedView = False

faceLevel = False

ViewHelper.SetObjectVisibility(selection, visibility, inSelectedView, faceLevel)

# EndBlock

 

# Change Object Visibility

selection = Selection.Create(select_bodies)

ViewHelper.HideOthers(selection)

# EndBlock

Tagged:

Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 345
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭

    Selection.GetActive() will get the active selection from the graphics window.