搜索
cad2007下载
软件下载
solidworks下载
proe下载
机械标准
机械招聘
机械图纸
机械百科
机械交易网
网站建设
机械设计手册
proe视频教程
cad2013视频教程
solidworks2008视频教程
CAD2004视频教程

[原创] solidworks宏执行的结果与录制宏时的结果不一样

[复制链接]
查看: 1441|回复: 2

该用户从未签到

发表于 2013-5-11 08:36:17 | 显示全部楼层 |阅读模式
本帖最后由 2627235904 于 2013-5-11 08:39 编辑

为什么录制时自己画的尺寸与执行宏后的尺寸不一样,求解释


宏代码


' C:\Users\Administrator\AppData\Local\Temp\swx1888\Macro1.swb - macro recorded on 05/11/13 by Administrator
' ******************************************************************************
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.ClearSelection2 True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.075276, -0.017318, 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.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

Part.ClearSelection2 True
Part.ClearSelection2 True
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.053176, -0.026538, 0#)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.02, 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

Part.ClearSelection2 True
Part.ClearSelection2 True
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.02502, -0.009058, 0#)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.03, 0.02, 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

1.jpg
2.jpg
回复

使用道具 举报

该用户从未签到

 楼主| 发表于 2013-5-11 08:37:43 | 显示全部楼层
代码如下:
回复 支持 反对

使用道具 举报

该用户从未签到

 楼主| 发表于 2013-5-11 08:38:03 | 显示全部楼层
' C:\Users\Administrator\AppData\Local\Temp\swx1888\Macro1.swb - macro recorded on 05/11/13 by Administrator
' ******************************************************************************
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.ClearSelection2 True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.075276, -0.017318, 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.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


Part.ClearSelection2 True
Part.ClearSelection2 True
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.053176, -0.026538, 0#)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.02, 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


Part.ClearSelection2 True
Part.ClearSelection2 True
Set skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.02502, -0.009058, 0#)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.03, 0.02, 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

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Copyright © 2012-2035 厦门鑫时器科技有限公司 版权所有
闽ICP备2023009579号-1 技术支持:机械网站建设  Powered by Discuz! X3.4
快速回复 返回顶部 返回列表