|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
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
开始我以为是solidworks系统选项->默认模板->零件(P)设置问题
但不论我把零件(P)设成“D:\Program Files\SolidWorks\data\templates\零件.prtdot”或“D:\Program Files\SolidWorks\lang\chinese-simplified\Tutorial\part.prtdot”都出现前面提到的问题
选用Set Part = swApp.NewDocument("D:\Program Files\SolidWorks\data\templates\零件.prtdot", 0, 0#, 0#)语句
运行后,圆的草绘平面是“上视基准面”
而选用“D:\Program Files\SolidWorks\lang\chinese-simplified\Tutorial\part.prtdot”运行后,圆的草绘平面是“前视基准面” |
|