API: How do I retrieve the quantity override value from an existing BOM balloon?

I am trying to read the quantity override value of an existing BOM balloon in a Drawing document, highlighted below:

  • An IBalloonOptions object allows you set this value and pass it to IModelDocExtension::InsertBOMBalloon2 which returns a Note, but this is for creating a new BOM Balloon.
  • The INote interface does not provide an obvious way to access the balloon options that created it.  Does anyone know how to do this?

Message was edited by: Michael PretekinEdited to clarify question

SolidworksApi macros
Answers 2
MP
MP 2015-04-15 Best Answer

Update: I figured out a workaround for the time being and wanted to post on the off chance somebody has the same issue.

I started adding watches to inspect the results of the various methods of the INote interface when a balloon was selected.  I discovered that a balloon with the "Quantity" checkbox shown returns a value of 3 when INote.GetTextCount is called.  When I call INote.GetTextAtIndex(3), it returns a concatenated string containing the quantity (or overridden value) and the Denotation string.

I haven't found a case where this information would not be stored at index 3, but it seems like a sort of hokey way of accessing that data.

Here is a simple macro I wrote to get the selected balloon so I could interrogate the object.  I just set a breakpoint on the End Sub line.

Dim swApp As Object
Dim swDocument As IModelDoc2
Dim selMgr As ISelectionMgr
Dim balloons As Object
Dim balloon As INote
Dim bStatus As Boolean

Sub main()

    Set swApp = Application.SldWorks
    Set swDocument = swApp.ActiveDoc
    Set selMgr = swDocument.SelectionManager
    Set balloon = selMgr.GetSelectedObject6(1, -1)

End Sub

The results:

comment imagecomment imagecomment imagecomment image
YN
YN 2015-05-04

Set myNote = Part.Extension.EditBalloonProperties(swBalloonStyle_e.swBS_Circular, swBalloonFit_e.swBF_2Chars, swBalloonTextContent_e.swBalloonTextCustom, "2.1", 0, "", 0.01016, False, 1, "X")