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

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

EESignature

(Not an Autodesk Employee)