You can create a new rule and add this. with this rule the bodies get selected depending on the type
Public Sub Main()
Select Case TYPE
Case "DIN 32676 SERIES 1"
setVisibility("DIN32676 SERIES1", True)
setVisibility("DIN32676SERIES2 STANDARD" , False)
Case "DIN 32676 SERIES 2 STANDARD"
setVisibility("DIN32676 SERIES1", false)
setVisibility("DIN32676SERIES2 STANDARD" , True)
Case "...."
' You might want to add more cases
End Select
End Sub
Public Sub setVisibility(bodyName As String, visible As Boolean)
Dim doc As PartDocument = ThisDoc.Document
Dim def As PartComponentDefinition = doc.ComponentDefinition
Dim bodies As IEnumerable(Of SurfaceBody) = def.SurfaceBodies.Cast(Of SurfaceBody)
Dim body As SurfaceBody = bodies.
Where(Function(b) b.Name.Equals(bodyName)).First()
body.Visible = visible
End Sub
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