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

Hi @Michael.Navara 

I am trying to convert the ILogic code to an API code but not sure what is the suitable type of "ModelGeometry" here (line ---)

The code is as follows

Option Explicit

Sub PartSelection()


'Select drawing curve of the part
Dim oPick As DrawingCurveSegment
Set oPick = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick drawing curve")

'Get assembly occurrene which the selected DrawingCurveSegment belongs to
Dim curveSegment As DrawingCurveSegment
Set curveSegment = oPick



Dim parentCurve As DrawingCurve
Set parentCurve = curveSegment.Parent
Dim someProxy As SketchProxy 'changed
Set someProxy = parentCurve.ModelGeometry
Dim partOcc As ComponentOccurrence
Set partOcc = someProxy.ContainingOccurrence

'Get AssemblyDocument referenced by DrawingView
Dim drawingView As drawingView 'needs to be checked
Set drawingView = drawingView.parentCurve.Parent
Dim viewAsm As AssemblyDocument
Set viewAsm = drawingView.ReferencedDocumentDescriptor.ReferencedDocument

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


'Get all DrawingCurveSegments of each part instance
'and convert them to ObjectCollection
Dim occDrawingCurvesCollection As ObjectCollection
Set occDrawingCurvesCollection = ThisApplication.TransientObjects.CreateObjectCollection()

Dim occ As ComponentOccurrence

For Each occ In allInstancesOfPartOcc
    Dim occDrawingCurves As DrawingCurvesEnumerator
    Set occDrawingCurves = drawingView.DrawingCurves(occ)
    
    Dim occDrawingCurve As DrawingCurve
    For Each occDrawingCurve In occDrawingCurves
    
    Dim occDrawingCurveSegment As DrawingCurveSegment
        For Each occDrawingCurveSegment 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
Set drawingDoc = drawingView.Parent.Parent
drawingDoc.SelectSet.SelectMultiple (occDrawingCurvesCollection)
End Sub

Could you please check it and let me know what is the appropriate object type for this case?

Thanks

Mohammad