Edit Balloon Example (VB.NET)
This example shows how to edit a balloon in a drawing document.
'
--------------------------------------------------------------------------
' Preconditions:
' 1. Open:
' <SolidWorks_install_dir>\samples\tutorial\advdrawings\foodprocessor.slddrw
' 2. Click Insert > Annotations > Balloon.
' 3. Click a model edge in either drawing view and add the balloon.
' 4. Close the Balloon PropertyManager page.
' 5. Select the balloon in the drawing.
'
' Postconditions:
' A balloon is added to the selected model
edge and then modified.
'
' NOTES: Because this drawing document is used in a
' SolidWorks
online tutorial, do not save any
' changes
made to the document when closing it.
'
--------------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System
Imports System.Diagnostics
Partial Class SolidWorksMacro
Public
Sub main()
Dim
swModel As ModelDoc2
Dim
swModelDocExt As ModelDocExtension
Dim
swDrawing As DrawingDoc
Dim
swSelMgr As SelectionMgr
Dim
swNote As Note
Dim
boolstatus As Boolean
swModel
= swApp.ActiveDoc
swModelDocExt
= swModel.Extension
swSelMgr
= swModel.SelectionManager
swDrawing
= swModel
boolstatus
= swModel.ActivateView("Drawing
View1")
'
Get the selected balloon
swNote
= swSelMgr.GetSelectedObject6(1,
-1)
'
Edit the selected balloon
swNote
= swModelDocExt.EditBalloonProperties(swBalloonStyle_e.swBS_Circular,
swBalloonFit_e.swBF_4Chars, swDetailingNoteTextContent_e.swDetailingNoteTextQuantity,
"Upper Text 2", swDetailingNoteTextContent_e.swDetailingNoteTextQuantity,
"Balloon Lower Text", 0, True, 2, "Denotation")
'
Balloon is actually a note
Debug.Print("Balloon
name: "
& swNote.GetName)
End
Sub
'''
<summary>
'''
The SldWorks swApp variable is pre-assigned for you.
'''
</summary>
Public
swApp As SldWorks
End Class