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

Iteration over drawing curves and check which model belongs to is highway to hell.

Much better is to get component from PartsListRow and obtain its drawing curves. The sample below show you just "HOW TO" . It is not full implementation. It just selects one of many drawing curves which belongs to un-balloned component.

 

Public Sub CheckPartsList()

    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument

    Dim oActiveSheet As Sheet
    Set oActiveSheet = oDrawDoc.ActiveSheet

    Dim oPartsList As PartsList
    Set oPartsList = oActiveSheet.PartsLists(1)

    Dim oPartslistRow As PartsListRow

    Dim asm As AssemblyDocument
    Set asm = oPartsList.ReferencedDocumentDescriptor.ReferencedDocument

    For Each oPartslistRow In oPartsList.PartsListRows

        If Not oPartslistRow.Ballooned Then

            Dim drawingBomRow As drawingBomRow
            Set drawingBomRow = oPartslistRow.ReferencedRows(1)
            
            Dim bomRow As bomRow
            Set bomRow = drawingBomRow.bomRow
            
            Dim compDef As ComponentDefinition
            Set compDef = bomRow.ComponentDefinitions(1)
            
            Dim occurrences As ComponentOccurrencesEnumerator
            Set occurrences = asm.ComponentDefinition.occurrences.AllReferencedOccurrences(compDef)
            
            Dim drawingCurvesEnumerator As drawingCurvesEnumerator
            Set drawingCurvesEnumerator = oActiveSheet.DrawingViews(1).DrawingCurves(occurrences(1))

            Call oDrawDoc.SelectSet.Clear
            Call oDrawDoc.SelectSet.Select(drawingCurvesEnumerator(1).Segments(1))

            MsgBox ("Continue")
        End If
    Next
    
End Sub