Python SpaceClaim API: Setting object visibility from selection

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


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(""):



# 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)


# EndBlock



  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 270
    First Anniversary First Comment 5 Likes Ansys Employee

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