1.連接Solidworks
’Dim swApp As Object
Set swApp = CreateObject (″SldWorks.Application″)‘
2.建立新的零件圖、裝配圖
’Dim Part As Object
Set Part = swApp.newpart //建立新零件圖‘
’Dim Assem As Object
Set Assem = swapp.NewAssembly //建立新裝配圖‘
3.插入草圖
’ModelDoc.InsertSketch //在所選平面上插入草圖‘
4.草圖繪制指令
’ModleDoc.CreateLine2(xStart ,yStart ,zStart ,xEnd , yEnd , zEnd) //直線繪制指令‘
’ModelDoc.CreateCircle2(xc ,yc ,zc ,xp ,yp ,zp) //圓繪制指令‘
C點(diǎn)(xc ,yc ,zc)為圓心坐標(biāo)
P點(diǎn)(xp,yp,zp)為圓上一點(diǎn)坐標(biāo)