Overridden Balloons

Overridden Balloons

gerardo_arellanoPYCV8
Explorer Explorer
344 Views
7 Replies
Message 1 of 8

Overridden Balloons

gerardo_arellanoPYCV8
Explorer
Explorer

Hello, I've been working with a macro that iterates through the balloons in a drawing with the intention of compare the balloons to the BOM.  I've tried several ways and did not work.

The main issue is getting the information of overridden balloons like this format = (item / qty).
I want to get the information of the qty overridden value, and I didn't have luck.

Is always an error like this: Object doesn't support this property or method.
reading more about it could be that my VBA project is not correctly referencing the Autodesk Inventor Object
Library.

gerardo_arellanoPYCV8_0-1750947460545.png

 



The code is attached.
to run the macro, you will first have to select a balloon and then the macro will print the information gotten from the balloon.

0 Likes
345 Views
7 Replies
Replies (7)
Message 2 of 8

MjDeck
Autodesk
Autodesk

Hi Gerardo - it looks like your references are OK. But your code is trying to use some properties and constants that are not in the Inventor API. A lot of your code works OK, but here are the problem areas.
The API has no properties named:
Balloon.FormattedText
ValueSet.Index

Please see if you can get the information you need from the existing properties on Balloon and ValueSet.

You have this line:

Select Case oBalloon.Type

That won't give you useful information. Every balloon with have the same Type. That Type property is just used to distinguish a balloon from a different type of object (e.g. DrawingCurve or Sheet or DrawingView).
You can use this instead:

Select Case oBalloon.GetBalloonType

That will give you detailed information. But the values from that won't match the ones you list: kItemBalloonType, kQuantityBalloonType etc. Please refer to the available values in BalloonTypeEnum.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 8

gerardo_arellanoPYCV8
Explorer
Explorer

Hello MjDeck, I tried your suggestion but did not work. 
I think it has to do with the format of the balloon, I'm trying to get the information of a split balloon like this (2/5) where I only got the information of the upper value, but
I'm not able to see the lower value of the balloon when a composite balloon is like the image below. 
it reads the information of the item, but not the overridden qty. That means that the balloon only contains one BalloonValueSet, even though it may visually show something

gerardo_arellanoPYCV8_0-1751463238397.png  gerardo_arellanoPYCV8_1-1751463309563.png

 

gerardo_arellanoPYCV8_4-1751463484084.png

 

 



Public Sub DebugBalloonEntries()

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

If oDoc.SelectSet.Count <> 1 Then
MsgBox "Select one balloon.", vbExclamation
Exit Sub
End If

Dim oBalloon As Balloon
Set oBalloon = oDoc.SelectSet(1)

Dim i As Integer
Dim output As String
output = "Entry Count: " & oBalloon.BalloonValueSets.Count & vbCrLf

For i = 1 To oBalloon.BalloonValueSets.Count
output = output & "Entry " & i & ": " & oBalloon.BalloonValueSets(i).Value & vbCrLf
Next i

MsgBox output, vbInformation, "Balloon Debug"

End Sub

 

0 Likes
Message 4 of 8

MjDeck
Autodesk
Autodesk

Hi Gerardo - my mistake. GetBalloonType can be called like this:

Dim balloonType As BalloonTypeEnum
Dim balloonTypeData As Variant
Call oBalloon.GetBalloonType(balloonType, balloonTypeData)
Debug.Print "Balloon type = " & balloonType


The BalloonValueSets are for attached balloons, not for split balloons. To see what's in a split balloon, you have to look at the Balloon.Style and BalloonStyle.Properties.
And also BalloonValueSet.ReferencedRow.   I started to put together sample code, but it's missing some functionality. I should be able to post it soon.


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 8

MjDeck
Autodesk
Autodesk

Hi Gerardo - here is a macro that will list up to two entries in each ValueSet. All the output goes to the Immediate window in Visual Basic. There are no message boxes.
Please try it out. It has a limitation: if the BalloonStyle does not specify the two-entry (split) balloon type, and a particular balloon has that style but is set to show two entries nevertheless, this will not be able to show the second entry. That's caused by an API limitation. We are planning to fix it.


Mike Deck
Software Developer
Autodesk, Inc.

Message 6 of 8

CGBenner
Community Manager
Community Manager

@gerardo_arellanoPYCV8 

Hi, Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 7 of 8

gerardo_arellanoPYCV8
Explorer
Explorer

Hello, good morning.
The macro is pulling the information from the BOM and not for the balloon manually created.

The intention is to read the values for the balloons that were created manually and overridden.

0 Likes
Message 8 of 8

MjDeck
Autodesk
Autodesk

Hi @gerardo_arellanoPYCV8 , the macro might not be complete in the case of overridden balloons. Can you post a small sample drawing in which it fails?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes