Sub Main()
Dim view As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select view")
Dim assembly As AssemblyDocument = view.ReferencedDocumentDescriptor.ReferencedDocument
For Each occ As ComponentOccurrence In assembly.ComponentDefinition.Occurrences
Dim occDoc As Document = occ.Definition.Document
If (occDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject) Then
Dim partDoc As PartDocument = occDoc
Dim name As String = partDoc.ComponentDefinition.SurfaceBodies.Item(1).Name
If (name.StartsWith("-")) Then
hideOccurence(view, occ)
End If
End If
Next
End Sub
Private Sub hideOccurence(view As DrawingView, occ As ComponentOccurrence)
For Each curve As DrawingCurve In view.DrawingCurves(occ)
For Each segment As DrawingCurveSegment In curve.Segments
segment.Visible = False
Next
Next
End Sub
this rule will only work if the first body has the prefix.
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