tonyhuangg 发表于 2004-10-15 10:39:00

blockreference getattributes

依据块名TBZ00,想用blockreference getattributes读出tagstring和textstring,但getattributes报错,帮忙看看
I = acaddoc.Blocks.Count
MsgBox (I)
For k = 1 To I
               s = acaddoc.Blocks.Item(k - 1).Name
               If UCase(s) = "TBZ00" Then
                                       Exit For
               End If
Next
Dim ent As AcadBlockReference
Dim s1 As Variant
s1 = ent.GetAttributes----出错:块或变量with未定义
For I = LBound(s1) To UBound(s1)
       
                                                                               If UCase(s1(I).TagString) = "DRAWNO" Then
                                                                                                               s = s1(I).TextString
                                                                               End If
        Next

efan2000 发表于 2004-10-15 13:29:00

ent没有赋值,应该要通过遍历模型空间来查找块,这里的块是块引用对象,而不是块集合中的块对象。
页: [1]
查看完整版本: blockreference getattributes