About Balloon – Circular with 2 Entries

<?xml encoding=”UTF-8″>By Xiaodong Liang

In default, the Balloon has only one circle, the number in which indicates the sequence ID of the component in BOM. Inventor allows you to configure more types of the Balloon format. e.g. Circular with 2 entries. And you can edit the format, also the contents of the circle: Balloon Value.

I thought the first column [ITEM] means the number in upper half circle, while [Override] means the number in lower half circle. I was wrong.

If you edit [ITEM], [Override] will change to the same value of [ITEM], and the number in upper half circle is the value. If you edit [Override], [Item] does not change, the number in upper half circle is the override value.

So the editing does nothing with the lower half circle! Why?

image

Actually, the lower half circle is defined by the Balloon Style >> Balloon Formatting >> Property Display

image

While the editing box of balloon provides you to edit Item only. So the editing is not relevant with the lower half circle at all.

If you want to change the number of the lower half circle, you need to change the QTY in BOM.

image

In addition, the formatting allows you to display any properties you need.

API has all of  the same abilities (from help reference)

Balloon.GetBalloonType:returns the balloon type:

<em><strong>Public Enum BalloonTypeEnum
kCircularWithOneEntryBalloonType</strong> = 48129
<strong>kCircularWithTwoEntriesBalloonType</strong> = 48130
<strong>kHexagonBalloonType</strong> = 48131
<strong>kLinearBalloonType</strong> = 48132
<strong>kNoneBalloonType</strong> = 48133
<strong>kSketchedSymbolBalloonType</strong> = 48134
<strong>End Enum</strong></em>

Balloon.BalloonValueSets is the collection of the values with the balloon. Currently, I can only see one value within it.

BalloonValueSet.Value: value of the set

BalloonValueSet.OverrideValue: override value of the set

BalloonValueSet.ItemNumber: original sequence number in BOM

BalloonValueSet.Static: this is an interesting Boolean. It  indicates whether the Value property has been overridden. Setting this property to False clears any overrides on the Value, but does not clear the ‘override value.’ The override value can be cleared by setting the OverrideValue property to a null string. This property is the equivalent of the PartListCell.Static property.

BalloonStyle.BalloonType: set formatting of balloon

BalloonStyle.Properties: the properties displayed in the balloon. The string can contain multiple properties separated by a semicolon (;). To specify a file property in the drawing document, use the following format:

FormatID='{32853F0F-3444-11d1-9E93-0060B03C1CA6}’ PropertyID=’29’

To specify a parts list property, use the enum value (long) of PropertyTypeEnum, with a ‘PartsListProperty’ keyword.

To specify a custom property from the model, use the ‘ModelCustomProperty’ keyword.

Example:

‘FormatID='{32853F0F-3444-11d1-9E93-0060B03C1CA6}’ PropertyID=’29’; FormatID='{32853F0F-3444-11d1-9E93-0060B03C1CA6}’ PropertyID=’27’; PartsListProperty=’45576′; ModelCustomProperty =’MyProperty”

where 45576 is the enum value corresponding to kBaseQuantityPartsListProperty.

 

Following is some demo codes

Sub changeItem()

    ‘ assume a balloon is selected

    Dim oBalloon As Balloon

    Set oBalloon = ThisApplication.ActiveDocument.SelectSet(1)

    Dim oBalloonType  As BalloonTypeEnum

    Dim oBalloonData As Variant

    Call oBalloon.GetBalloonType(oBalloonType, oBalloonData)

    If oBalloonType = kCircularWithTwoEntriesBalloonType Then

        Dim oBVS As BalloonValueSet

        Set oBVS = oBalloon.BalloonValueSets(1)

        ‘edit [Item]

        oBVS.Value = “111”

        ‘print [Item] and [Override]

        Debug.Print oBVS.Value

         Debug.Print oBVS.OverrideValue

    End If

End Sub

Sub changeOverride()

    ‘ assume a balloon is selected

    Dim oBalloon As Balloon

    Set oBalloon = ThisApplication.ActiveDocument.SelectSet(1)

    Dim oBalloonType  As BalloonTypeEnum

    Dim oBalloonData As Variant

    Call oBalloon.GetBalloonType(oBalloonType, oBalloonData)

    If oBalloonType = kCircularWithTwoEntriesBalloonType Then

        Dim oBVS As BalloonValueSet

        Set oBVS = oBalloon.BalloonValueSets(1)

        ‘edit [Override]

        oBVS.OverrideValue = “222”

        ”print [Item] and [Override]

        Debug.Print oBVS.Value

         Debug.Print oBVS.OverrideValue

    End If

End Sub

Sub resetToOriginal()

    ‘ assume a balloon is selected

    Dim oBalloon As Balloon

    Set oBalloon = ThisApplication.ActiveDocument.SelectSet(1)

    Dim oBalloonType  As BalloonTypeEnum

    Dim oBalloonData As Variant

    Call oBalloon.GetBalloonType(oBalloonType, oBalloonData)

    If oBalloonType = kCircularWithTwoEntriesBalloonType Then

        Dim oBVS As BalloonValueSet

        Set oBVS = oBalloon.BalloonValueSets(1)

        Debug.Print “序号原始值: ” & oBVS.ItemNumber

         ‘reset [Item] to original number in BOM

        oBVS.Static = False

        ”’print [Item] and [Override]

        Debug.Print oBVS.Value

         Debug.Print oBVS.OverrideValue

    End If

End Sub

Sub changeStyleType()

    ‘ get current balloon style from a balloon 
    Dim oBS As BalloonStyle

     Set oBS = ThisApplication.ActiveDocument.SelectSet(1).Style

     ‘set type

     oBS.BalloonType = kCircularWithTwoEntriesBalloonType

     ‘the properties want to display

     Dim oProperties  As String

     oProperties = ” FormatID='{32853F0F-3444-11d1-9E93-0060B03C1CA6}’ PropertyID=’29’; FormatID='{32853F0F-3444-11d1-9E93-0060B03C1CA6}’ PropertyID=’27′”

     oBS.Properties = oProperties

End Sub


Comments

One response to “About Balloon – Circular with 2 Entries”

  1. So if I want to change the text color of a balloon through iLogic, how would I do that?

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading