Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.SketchManager.InsertSketch True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateLine(0.00045, 0.00045, 0#, 0.00045, 0.00225, 0#)
End Sub
求高手指点:solidworks二次开发,此直线为何画不出来?
答案:2 悬赏:60 手机版
解决时间 2021-02-02 00:39
- 提问者网友:温柔港
- 2021-02-01 02:05
最佳答案
- 五星知识达人网友:鱼芗
- 2021-02-01 02:14
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks ‘这边注意一下
Set Part = swApp.ActiveDoc
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.CreateLine(0.00045, 0.00045, 0#, 0.00045, 0.00225, 0#)
End Sub
这段代码是可以画出直线来的,但是由于你定义的直线距离太短(1.8mm),在新建的文件里面用代码绘制该直线的时候显示不出来。必须要把绘图区域先放大一点再运行该段代码才可以。或者把直线的距离改大一点,也能绘制出来
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks ‘这边注意一下
Set Part = swApp.ActiveDoc
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.CreateLine(0.00045, 0.00045, 0#, 0.00045, 0.00225, 0#)
End Sub
这段代码是可以画出直线来的,但是由于你定义的直线距离太短(1.8mm),在新建的文件里面用代码绘制该直线的时候显示不出来。必须要把绘图区域先放大一点再运行该段代码才可以。或者把直线的距离改大一点,也能绘制出来
全部回答
- 1楼网友:空山清雨
- 2021-02-01 03:06
同问。。。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯