这段代码在简单的图纸中可以,但是如果图纸很大。一般cad都是好多符图纸,这个过滤机制,就会很慢,基本卡住,求优化!
只在block块中操作的。试过for each block in block这样写代码可是老是出错!帮帮忙!代码如下:
Dim I As Integer
Dim ObjName As String
ObjName = InputBox("请输入一个要重新编号对象的名称")
With AcadApp.ActiveDocument
Dim entry As AcadEntity, blk1 As AcadBlockReference, att1 As AcadAttributeReference
Dim varAttributes As Variant
Dim strAttributes As String
For Each entry In .ModelSpace
If entry.ObjectName = "AcDbBlockReference" Then
Set blk1 = entry
If blk1.Name = ObjName Then
varAttributes = entry.GetAttributes
varAttributes(0).TextString ="已修改"
End If
End If
Next
End With