11-02-2022
08:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-02-2022
08:00 AM
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 SubCould you please check it and let me know what is the appropriate object type for this case?
Thanks
Mohammad