打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
VBA 二次开发小程序,多几何体零件,快速删除空几何体

Sub CATMain()

Dim selection1 As Selection

Set Document = CATIA.ActiveDocument

Set Bodies = Document.Part.Bodies

Set selection1 = Document.Selection

For i = 1 To Bodies.Count

If CheckEmptyBody(Bodies.Item(i)) = True Then

selection1.Add Bodies.Item(i)

End If

Next

selection1.Delete

MsgBox 'Empty Bodies Deleted '

End Sub

Function CheckEmptyBody(body) As Boolean

Dim HybridShapes As HybridShapes

Dim ogs As OrderedGeometricalSets

Dim shapes As shapes

Dim Sketches1 As Sketches

Set HybridShapes = body.HybridShapes

Set ogs = body.OrderedGeometricalSets

Set shapes = body.shapes

Set Sketches = body.Sketches


On Error Resume Next


Count1 = HybridShapes.Count

Count2 = ogs.Count

Count3 = shapes.Count

Count4 = Sketches.Count


On Error GoTo 0


If Count1 = 0 And Count2 = 0 And Count3 = 0 And Count4 = 0 Then

CheckEmptyBody = True


Else

CheckEmptyBody = False

End If


End Function

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
Word 宏命令大全
如何批量删除PPT动画
word批量修改图片大小
PPT进度条制作
使用vba批量修改ppt公式颜色
Excel VBA
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服