Hide Table of Contents

Get BOM Balloon Properties Example (VBA)

This example shows how to get the properties of a BOM balloon.

 

'---------------------------------------------------

'

' Preconditions:

'      (1) Model document is open.

'      (2) BOM balloon is selected.

'

' Postconditions: None

'

'----------------------------------------------------

Option Explicit

Public Enum swAnnotationType_e

    swCThread = 1

    swDatumTag = 2

    swDatumTargetSym = 3

    swDisplayDimension = 4

    swGTol = 5

    swNote = 6

    swSFSymbol = 7

    swWeldSymbol = 8

    swCustomSymbol = 9

    swDowelSym = 10

    swLeader = 11

    swBlock = 12

    swCenterMarkSym = 13

    swTableAnnotation = 14

    swCenterLine = 15

End Enum

Public Enum swSelectType_e

    swSelNOTHING = 0

    swSelEDGES = 1              '  "EDGE"

    swSelFACES = 2              '  "FACE"

    swSelVERTICES = 3           '  "VERTEX"

    swSelSKETCHSEGS = 10        '  "SKETCHSEGMENT"

    swSelSKETCHPOINTS = 11      '  "SKETCHPOINT"

End Enum

Public Enum swBalloonStyle_e

    swBS_None = 0

    swBS_Circular = 1

    swBS_Triangle = 2

    swBS_Hexagon = 3

    swBS_Box = 4

    swBS_Diamond = 5

    swBS_SplitCirc = 6

    swBS_Pentagon = 7

    swBS_FlagPentagon = 8

    swBS_FlagTriangle = 9

    swBS_Underline = 10

End Enum

Public Enum swDetailingNoteTextContent_e

    swDetailingNoteTextCustom = 1

    swDetailingNoteTextItemNumber = 2

    swDetailingNoteTextQuantity = 3

End Enum

Public Enum swBalloonFit_e

    swBF_Tightest = 0

    swBF_1Char = 1

    swBF_2Chars = 2

    swBF_3Chars = 3

    swBF_4Chars = 4

    swBF_5Chars = 5

End Enum

Sub main()

    Dim swApp                       As SldWorks.SldWorks

    Dim swModel                     As SldWorks.modelDoc

    Dim swSelMgr                    As SldWorks.SelectionMgr

    Dim swNote                      As SldWorks.note

    Dim swAnn                       As SldWorks.Annotation

    Dim vAttEntArr                  As Variant

    Dim vAttEntTypeArr              As Variant

    Dim swEnt                       As SldWorks.entity

    Dim swComp                      As SldWorks.component

    Dim swCompModel                 As SldWorks.modelDoc

    Dim i                           As Long

    Dim bRet                        As Boolean

    

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swSelMgr = swModel.SelectionManager

    Set swNote = swSelMgr.GetSelectedObject5(1)

    Set swAnn = swNote.GetAnnotation

    

    Debug.Assert swNote.IsBomBalloon

    

    vAttEntArr = swAnn.GetAttachedEntities2: If IsEmpty(vAttEntArr) Then Exit Sub

    vAttEntTypeArr = swAnn.GetAttachedEntityTypes

    Debug.Assert UBound(vAttEntArr) = UBound(vAttEntTypeArr)

    

    Debug.Print "File = " & swModel.GetPathName

    Debug.Print "  Name                 = " & swAnn.GetName

    Debug.Print "    Upper text         = " & swNote.GetBomBalloonText(True) & " [" & swNote.GetBomBalloonTextStyle(True) & "]"

    Debug.Print "    Lower text         = " & swNote.GetBomBalloonText(False) & " [" & swNote.GetBomBalloonTextStyle(False) & "]"

    Debug.Print "    Balloon fit        = " & swNote.GetBalloonSize

    Debug.Print "    Balloon style      = " & swNote.GetBalloonStyle

    Debug.Print "    Is stacked          = " & swNote.IsStackedBalloon

    Debug.Print "    Is stacked master    = " & swNote.IsStackedBalloonMaster

    

    For i = 0 To UBound(vAttEntArr)

        Debug.Print "    AttEntType         = " & vAttEntTypeArr(i)

        

        If swSelNOTHING <> vAttEntTypeArr(i) Then

            Set swEnt = vAttEntArr(i)

            Set swComp = swEnt.GetComponent

            Set swCompModel = swComp.GetModelDoc

                    

            Debug.Print "    AttEnt             = " & swComp.GetPathName & " <" & swComp.ReferencedConfiguration & ">" & " --> " & swCompModel.GetPathName

        End If

    Next i

End Sub

'---------------------------------------------------



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Get BOM Balloon Properties Example (VBA)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2012 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.