As far a i know there are 3 ways to get the surface body. by looping over:
- PartDocumen.ComponentDefinition.SurfaceBodies
- PartDocumen.ComponentDefinition.Features.item(x).SurfaceBodies
- browsernodes.
it looks like the body stops to exist when there are none features for it. The browser node is visable but the underling body gives an exception when it is used.
i dont know any more options to get the body and hide it..... therefore i cant help you maby some one else knows. below you will find the iLogic code that i used to test the different options maby it helps someone.
Dim doc As PartDocument = ThisApplication.ActiveDocument
'tryed looping over all bodies. Only bodies with an has an unsuppresed feature are in the list
For Each body As SurfaceBody In doc.ComponentDefinition.SurfaceBodies
MsgBox("Test 1: " & body.Name)
Next
'tryed looping over all features and have a look at the bodies that consume that feature.
'suppresed Features are found but there is only a body if the body has an unsuppresed feature
For Each Feature As PartFeature In doc.ComponentDefinition.Features
If (Feature.SurfaceBodies IsNot Nothing) Then
MsgBox("Test 2: " & Feature.Name & " + " & Feature.SurfaceBodies.Item(1).Name)
Else
MsgBox("Test 2: " & Feature.Name & " does not belong to any SurfaceBody")
End If
Next
'tryed looking up the bodie by the browser.
'i can find all nodes for bodies but can only get the nativeobject of the node (the body)
'If the Then body has an unsuppresed feature
For Each node As BrowserNode In doc.BrowserPanes.Item("Model").TopNode.BrowserNodes
If (node.BrowserNodeDefinition.Label.Contains("Solid Bodies")) Then
For Each bodyNode As BrowserNode In node.BrowserNodes
MsgBox("Test 3: " & bodyNode.BrowserNodeDefinition.Label)
Dim body As SurfaceBody = bodyNode.NativeObject
Next
End If
Next
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com