我vb的编程是这样的:
Dim swApp As Object
Dim filename As Variant
Dim Part As Object
Sub main()
Dim textline As Variant
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim x As Double
Dim y As Double
Dim z As Double
'读取txt数据,并进入绘图模式
Open "F:\study\sw-ercikaifa\test\test3.txt" For Input As #1
Part.InsertSketch2 True
'逐行得出字符串格式,分割行数据,拆分成三个数字
Do While Not EOF(1)
Line Input #1, textline
Dim point As Variant
point = Split(textline, " ")
x = Val(point(0)) / 1000
y = Val(point(1)) / 1000
z = Val(point(2)) / 1000
Part.CreatePoint2 x, y, z
Part.ClearSelection2 True
Part.SetPickMode
Loop
Close #1
End Sub