- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to write a program that checks which parts are not ballooned in the BOM and then goes through all the drawing curves in the assembly drawing to balloon them. However, an error occurs when attempting to get ModelGeometry from DrawingCurve (line 38). Can someone help me resolve this issue?
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 lstOfComponents As String
For Each oPartslistRow In oPartsList.PartsListRows
If oPartslistRow.Ballooned = False Then
Dim ItemNumber As String
ItemNumber = oPartslistRow.Item(5).Value
lstOfComponents = ItemNumber
End If
Next
Dim oDrawView As DrawingView
Set oDrawView = oActiveSheet.DrawingViews.Item(1)
Dim oDrawCurves As DrawingCurvesEnumerator
Set oDrawCurves = oDrawView.DrawingCurves
Dim oDrawCurve As DrawingCurve
Dim oCurveModelGeometry As Object
Dim oCurveContainingOccurence As Object
Dim PartNameFromCurve
For Each oDrawCurve In oDrawCurves
Set oCurveModelGeometry = oDrawCurve.ModelGeometry
'-------------delet part name from ":"
Set oCurveContainingOccurence = oCurveModelGeometry.ContainingOccurrence
PartNameFromCurve = oCurveContainingOccurence.Name
colonPosition = InStr(PartNameFromCurve, ":")
If colonPosition > 0 Then
ConfiguredPartNameFromCurve = Left(PartNameFromCurve, colonPosition - 1)
Else
ConfiguredPartNameFromCurve = PartNameFromCurve
End If
'---------------------------
'-----------compare part name from BOM and Drawingcurve
If ConfiguredPartNameFromCurve = lstOfComponents Then
MsgBox (PartNameFromCurve)
Exit For
End If
'---------------------------
Next
Stop
End Sub
Solved! Go to Solution.