AnsweredAssumed Answered

Balloon-change between item no. and props

Question asked by Niels Raahauge on Aug 30, 2018
Latest reply on Oct 17, 2018 by Peter Pankras

Hi

I use two kind of balloon.

1) item number with circle

2) Custom property SAPMaterrial without circle.

I want a macro to change between those to. Finding all the balloons  and change to SAPMaterial is working. 

But I can't find out how to detect the Balloon type to get the chose, and ether how to get the item no. in the balloon.

I found:  swDetailingNoteTextItemNumber 2  but can't figure out how to use it.

Can somebody help, please. (I have comment out my best guess)

 

'open a drawing with balloons

'Macro to change all balloons to custom property: SAPMaterial

Dim swApp As Object

Dim Drw As Object

Dim View As Object

Dim Note As Object

Dim Bool As Boolean

'Dim swAnnotation As Annotation

'Dim BaloonType As Integer

 

Sub main()

 

Set swApp = Application.SldWorks

Set Drw = swApp.ActiveDoc

If Not Drw Is Nothing Then

   If Drw.GetType = 3 Then            'Activedoc = Drawing?

      Set View = Drw.GetFirstView     '= drawing sheet

      Set View = View.GetNextView     '= first real view

     

      While Not View Is Nothing       'loop through views

         Set Note = View.GetFirstNote

        

         While Not Note Is Nothing    'loop through notes

            If Note.IsBomBalloon Then

'               swAnnotation = Note.GetAnnotation

'                BaloonType = swAnnotation.GetAttachedEntityTypes

                            

'              If BaloonType = 2 Then 'item number

                    Bool = Note.SetBalloon(0, 0)  'no circle

                    Bool = Note.SetBomBalloonText(4, "$PRPMODEL:" & Chr(34) & "SAPMaterial" & Chr(34), 1, "") 'SetBallonToSAPMaterial

'               Else

'                   Bool = Note.SetBalloon(1, 0)  'circle

'                   Bool = Note.SetBomBalloonText(>>>itemnumber<<<<<

            End If

            Set Note = Note.GetNext

         Wend

         Set View = View.GetNextView

      Wend

   End If

End If

 

End Sub

Outcomes