- 积分
- 574
- 明经币
- 个
- 注册时间
- 2005-5-11
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2005-6-2 18:22:00
|
显示全部楼层
这段程序是建立一个选择集,将标注对象加入选择集,把所有的标注都删除
当然,有更好的办法更好,请看一下下面的代码
Set ACADapp = GetObject(, "AutoCAD.Application") Set ACADdoc = ACADapp.ActiveDocument Dim ssetObj As AcadSelectionSet ACADapp.ActiveDocument.SelectionSets("TEST_SELECTIONSET").Delete Set ssetObj = ACADapp.ActiveDocument.SelectionSets.Add("TEST_SELECTIONSET") Dim i As Long Dim obj As AcadObject
i = 0 For Each obj In ACADapp.ActiveDocument.ModelSpace '遍历工作区中的实体 Select Case obj.EntityName Case "AcDbMText", "AcDbText", "AcDbRadialDimension", "AcDb3PointAngularDimension", "AcDbRotatedDimension", "AcDbAlignedDimension", "AcDbOrdinateDimension", "AcDbFcf", "AcDbLeader" i = i + 1 Case Else End Select Next obj
MsgBox i ReDim ssobjs(0 To i) As AcadEntity
i = 0 For Each obj In ACADapp.ActiveDocument.ModelSpace '遍历工作区中的实体 Select Case obj.EntityName Case "AcDbMText", "AcDbText", "AcDbRadialDimension", "AcDb3PointAngularDimension", "AcDbRotatedDimension", "AcDbAlignedDimension", "AcDbOrdinateDimension", "AcDbFcf", "AcDbLeader" Set ssobjs(i) = ACADapp.ActiveDocument.ModelSpace.Item(i) i = i + 1 Case Else End Select
Next obj MsgBox i ssetObj.AddItems ssobjs '这句老提示空对象指针,是怎么回事 ssetObj.Erase
|
|