solidworks2010里录制的宏放到VB6.0里面运行不出来。也不报错就是点运行没反应,麻烦大神帮忙看下啊
DimswAppAsObjectDimPartAsObjectDimboolstatusAsBooleanDimlongstatusAsLong,longwarnings...
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Private Sub Command1_Click()
Set swApp = _
CreateObject("sldworks.application")
Set Part = swApp.NewDocument("C:\ProgramData\SolidWorks\SolidWorks 2010\templates\零件.prtdot", 0, 0, 0)
swApp.ActivateDoc2 "零件1", False, longstatus
'Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
'myModelView.FrameState = swWindowState_e.swWindowMaximized
boolstatus = Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.SketchManager.InsertSketch True
'Part.ClearSelection2 True
'Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.028689, 0.008771, 0#)
'Part.ShowNamedView2 "*上下二等角轴测", 8
'Part.ClearSelection2 True
'boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
'Dim myFeature As Object
Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.03, 0.01, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, True, True, True, 0, 0, False)
Part.SelectionManager.EnableContourSelection = False
End Sub 展开
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Private Sub Command1_Click()
Set swApp = _
CreateObject("sldworks.application")
Set Part = swApp.NewDocument("C:\ProgramData\SolidWorks\SolidWorks 2010\templates\零件.prtdot", 0, 0, 0)
swApp.ActivateDoc2 "零件1", False, longstatus
'Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
'myModelView.FrameState = swWindowState_e.swWindowMaximized
boolstatus = Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.SketchManager.InsertSketch True
'Part.ClearSelection2 True
'Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.028689, 0.008771, 0#)
'Part.ShowNamedView2 "*上下二等角轴测", 8
'Part.ClearSelection2 True
'boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
'Dim myFeature As Object
Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.03, 0.01, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, True, True, True, 0, 0, False)
Part.SelectionManager.EnableContourSelection = False
End Sub 展开
1个回答
展开全部
VBA宏里用纳笑升到原软件支持的部分放到升简VB6里用是无效的。这一个个都洞老是object的不引用等于什么都没有啊。
更多追问追答
追问
那应该怎么修改啊 http://zhidao.baidu.com/question/283179805.html?fr=push 这个里面的我都按着改了 可还是没反应 也不报错 - -
追答
不知道,没用过solidworks,试试把solidworks开着运行这段?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |