马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
Private Sub Command1_Click()
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Set swApp = CreateObject("sldworks.application")
swApp.UserControl = True
Set Part = swApp.NewDocument("D:\Program Files\SOLIDWORKS\data\templates\零件.prtdot", 0, 0#, 0#)
'Set Part = swApp.NewDocument("D:\Program Files\SolidWorks\lang\chinese-simplified\Tutorial\part.prtdot", 0, 0#, 0#)
'有一个问题,选用这个模板后,boolstatus = Part.Extension.SelectByID2 不能选择其他的基准平面,系统自动选择从“前视基准面”开始画草图,即"boolstatus = Part.Extension.SelectByID2("上视基准面", "PLANE", 0#, 0#, 0#, False, 0, Nothing, 0)"无效,执行后boolstatus的值为false
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("上视基准面", "PLANE", 0#, 0#, 0#, False, 0, Nothing, 0)
Part.InsertSketch2 True
Part.CreateCircleByRadius2 0, 0, 0, 0.01
End Sub |