2 Replies Latest reply on May 4, 2015 9:06 AM by Yong Ning

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

    Michael Pretekin

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

      Capture.JPG

       

      • 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 Pretekin Edited to clarify question

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

          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:

          Capture.JPGCapture1.JPG