it can run in my computer , the following VB code is ok,now ,my problem is what should i to add in my code,and i can change the fontname by the add code.
is there someone used it before ?
thank you !
-------------------------------------------------------------------------------------------------------------------------------------------------------
Private Sub Command1_Click()
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Set swApp = CreateObject("SldWorks.application")
swApp.Visible (True)
Set Part = swApp.Newpart()
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
boolstatus = Part.Extension.SketchBoxSelect("0.000000", "0.000000", "0.000000", "0.000000", "0.000000", "0.000000")
boolstatus = Part.Extension.SelectByID2("上视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.SketchManager.InsertSketch True
boolstatus = Part.Extension.SelectByID2("上视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCenterLine(0#, 0#, 0#, 0.01, 0#, 0#)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Line1", "SKETCHSEGMENT", 0, 0, 0, False, 1, Nothing, 0)
Dim mySketchText As Object
Set mySketchText = Part.InsertSketchText(0, 0, 0, "OK", 0, 0, 0, 100, 100)
Part.ClearSelection2 True
Part.SketchManager.InsertSketch True
Part.ShowNamedView2 "*上视", 5
Part.ViewZoomtofit2
End Sub
SolidworksApi macros