08-23-2022
08:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-23-2022
08:21 AM
Hi @phankinsTURWH. I don't know how you want to change the balloons once you find them (what style to set them to), but this example code should help get you started down the right path. Give this a try and let me know if it functions properly to let you know which balloons are attached to what type of model document.
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing document must be active for this code to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDoc.Document
For Each oSheet As Sheet In oDDoc.Sheets
For Each oBalloon As Balloon In oSheet.Balloons
If oBalloon.Attached = False Then Continue For
Dim oBVS As BalloonValueSet = oBalloon.BalloonValueSets.Item(1)
Dim oDBOMRow As DrawingBOMRow = oBVS.ReferencedRow
If oDBOMRow.Virtual Or oDBOMRow.Custom Then Continue For
Dim oBOMRow As BOMRow = oDBOMRow.BOMRow
Dim oCD = oBOMRow.ComponentDefinitions.Item(1)
If TypeOf oCD Is PartComponentDefinition Then
MsgBox("Balloon #: " & oBVS.ItemNumber & ", on Sheet: " & oSheet.Name & _
vbCrLf & "is attach to a Part.",vbInformation,"Balloon Report")
ElseIf TypeOf oCD Is AssemblyComponentDefinition Then
MsgBox("Balloon #: " & oBVS.ItemNumber & ", on Sheet: " & oSheet.Name & _
vbCrLf & "is attach to an Assembly.",vbInformation,"Balloon Report")
End If
Next
Next
Wesley Crihfield
(Not an Autodesk Employee)