|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
录制了一个一键删除边界框的宏,代码如下。这个宏只能对应删除切割清单项目1~15的边界框,超出范围的删不了,当然笨办法是有:一直从切割清单项目1列到切割清单项目100、1000等,所以,想搞一个循环语句遍历所有的切割清单项目,苦于编程水平太差,求论坛各位高手指教,谢谢!
- 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("实体", "BDYFOLDER", 0, 0, 0, False, 0, Nothing, 0)
- Part.ClearSelection2 True
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目1", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目2", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目3", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目4", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目5", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目6", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目7", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目8", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目9", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目10", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目11", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目12", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目13", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目14", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- boolstatus = Part.Extension.SelectByID2("边界框_切割清单项目15", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
- Part.EditDelete
- End Sub
复制代码
|
|