Anchor a Note Example (VB.NET)
This example shows how to anchor a note and set its text to all uppercase.
'----------------------------------------------------------------------------
' Preconditions: Open install_dir\samples\tutorial\advdrawings\foodprocessor.slddrw.
'
' Postconditions:
' 1. Inserts and locks the note, Drawing View1 Note, at the
' specified position and sets the note's text to all uppercase.
' 2. Examine the graphics area.
'
' NOTE: Because the model is used elsewhere, do not save changes.
'---------------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
Partial Class SolidWorksMacro
Dim Part As ModelDoc2
Dim myNote As Note
Dim myAnnotation As Annotation
Dim boolstatus As Boolean
Sub main()
Part = swApp.ActiveDoc
myNote = Part.InsertNote("Drawing View1 Note")
If Not myNote Is Nothing Then
myNote.LockPosition = True
myNote.AllUpperCase = True
myAnnotation = myNote.GetAnnotation()
If Not myAnnotation Is Nothing Then
boolstatus =
myAnnotation.SetPosition(0.2, 0.269, 0)
End If
End If
Part.ClearSelection2(True)
Part.WindowRedraw()
End Sub
Public swApp As SldWorks
End Class