Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Here is commented example how to get all drawing curve segments of all instances of part.

 

'Select drawing curve of the part
Dim pick = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick drawing curve")

'Get assembly occurrene which the selected DrawingCurveSegment belongs to
Dim curveSegment As DrawingCurveSegment = pick
Dim parentCurve As DrawingCurve = curveSegment.Parent
Dim someProxy = parentCurve.ModelGeometry
Dim partOcc As ComponentOccurrence = someProxy.ContainingOccurrence

'Get AssemblyDocument referenced by DrawingView
Dim drawingView As DrawingView = drawingCurve.Parent
Dim viewAsm As AssemblyDocument = drawingView.ReferencedDocumentDescriptor.ReferencedDocument

'Get all occurrences which has the same ComponentDefinition
Dim allInstancesOfPartOcc As ComponentOccurrencesEnumerator = _
viewAsm.ComponentDefinition.Occurrences.AllLeafOccurrences(partOcc.Definition)


'Get all DrawingCurveSegments of each part instance
'and convert them to ObjectCollection
Dim occDrawingCurvesCollection As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
For Each occ As ComponentOccurrence In allInstancesOfPartOcc
	Dim occDrawingCurves As DrawingCurvesEnumerator = drawingView.DrawingCurves(occ)
	For Each occDrawingCurve As DrawingCurve In occDrawingCurves
		For Each occDrawingCurveSegment As DrawingCurveSegment In occDrawingCurve.Segments
			occDrawingCurvesCollection.Add(occDrawingCurveSegment)
		Next
	Next
Next

'Do something useful with occDrawingCurvesCollection

'Select all DrawingCurveSegments of the occ in the DrawingView
Dim drawingDoc As DrawingDocument = drawingView.Parent.Parent
drawingDoc.SelectSet.SelectMultiple(occDrawingCurvesCollection)