标题:各位大神棒棒忙,vb语言对solidworks二次开发的问题
只看楼主
manycrazy
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-3-16
结帖率:0
已结贴  问题点数:20 回复次数:3 
各位大神棒棒忙,vb语言对solidworks二次开发的问题
把宏中的代码直接贴到vb中就出错了,在vba中运行还没事儿,怎么就不行了呢,新手求助

 Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim warning As Long
Dim error As Long
Private Sub Command1_Click()
Set swApp = CreateObject("SldWorks.Application")
Set swPart = swApp.ActiveDoc
swApp.Visible = True
Set swPart = swApp.OpenDoc6("C:\Documents and Settings\All Users\Application Data\SolidWorks\SolidWorks 2012\templates\零件.prtdot", swDocPART, swOpenDocOptions_Silent, "", error, warning)

boolstatus = Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.011494, 0.036051, 0#)
Part.ClearSelection2 True
Part.SketchManager.InsertSketch True
Part.ShowNamedView2 "*上下二等角轴测", 8
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("草图1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Dim myFeature As Object
Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.01, 0.01, False, False, False, False, 1.74532925199433E-02, 1.74532925199433E-02, False, False, False, False, True, True, True, 0, 0, False)
Part.SelectionManager.EnableContourSelection = False

End Sub

搜索更多相关主题的帖子: SolidWorks Documents warning 
2013-03-16 00:54
Susake
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:女儿国的隔壁
等 级:贵宾
威 望:23
帖 子:2288
专家分:6481
注 册:2012-12-14
得分:7 
不懂VB的来帮你顶下

仰望星空...........不忘初心!
2013-03-16 00:54
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1817
专家分:3681
注 册:2011-3-24
得分:7 
kk

不要選我當版主
2013-03-16 15:02
wp231957
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:神界
等 级:版主
威 望:422
帖 子:13681
专家分:53296
注 册:2012-10-18
得分:7 
vb和vba当然不一样啦

DO IT YOURSELF !
2013-03-16 15:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-400901-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.996076 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved