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点(xc ,yc ,zc)为圆心坐标
P点(xp,yp,zp)为圆上一点坐标
网友评论