Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: jgomis.ext

By the way, here is another route for controlling the visibility of SurfaceBody geometry within a drawing view of a multi-body part.  This simple example uses a property of the DrawingView object called DrawingCurves, which will retrieve all view geometry for the model reference you input into it.  Then you can loop through the contents of that collection of geometry to turn the visibility of the geometry off.  This example is just getting the first view on the active sheet of the drawing, then attempting to get the third body in the part, but you can change any of that as needed.

Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oView As DrawingView = oDDoc.ActiveSheet.DrawingViews.Item(1)
Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
If oModel.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
	Dim oPDoc As PartDocument = oModel
	If oPDoc.ComponentDefinition.HasMultipleSolidBodies = False Then Exit Sub
	Dim oBodies As SurfaceBodies = oPDoc.ComponentDefinition.SurfaceBodies
	Dim oBody3 As SurfaceBody = oBodies.Item(3)
	Dim oBodyGeomInView As DrawingCurvesEnumerator = oView.DrawingCurves(oBody3)
	If oBodyGeomInView.Count = 0 Then Exit Sub
	For Each oDC As DrawingCurve In oBodyGeomInView
		For Each oDCS As DrawingCurveSegment In oDC.Segments
			oDCS.Visible = False
		Next
	Next
End If

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) :thumbs_up:.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)