Insert Text at Angle Example (VBA)
This example shows how to insert text at an angle.
'---------------------------------------------------------
'
' Preconditions: Part
or assembly document is open.
'
' Postconditions: Text string "Part2.SLDPRT"
is inserted as a sketch,
' at
the origin, and at an angle.
'
'----------------------------------------------------------
Option Explicit
Sub main()
'
Specify rotation angle in degrees from vertical,
'
probably relative to sketch transform
Const
sSketchText As
String = "<r65>Part2.SLDPRT</r>"
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swSkText As
SldWorks.SketchText
Dim
bRet As
Boolean
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
'
Need VB to access clipboard
'
Clipboard.GetFormat(vbCFText)
'
Clipboard.GetText
Set
swSkText = swModel.InsertSketchText(
_
0#,
0#, 0#, _
sSketchText,
0, _
0,
0, 100, 100)
End Sub
'-----------------------------------