访问块中的对象
请问怎么访问和操作块中对象。最好有例子程序,谢谢!补充一下,块不能炸开。 这样吧,换个思路,怎样将炸掉后的对象合并成一个新块。 其实,访问块中的图形实体和访问模型空间ModelSpace的图形实体是一样的,只是名字不同而已 为什么我遍历模型空间时,只能读出块引用BlockReference一个元素呢。
Public Sub ss()
Dim objB As AcadBlock
Set objB = ThisDrawing.Blocks("aaaa")'有一个块名叫aaaa
Dim objEnt As AcadEntity
For Each objEnt In objB
Debug.Print objEnt.ObjectName
Next
End Sub
我已经解决了,我是用.net的方法
Private Shared Sub getBlockSubEntity(ByVal ed As Editor, ByVal trans As Transaction, ByVal blockObject As BlockReference)
'获取图块的块表记录
Dim btrBlock As BlockTableRecord = trans.GetObject(blockObject.BlockTableRecord, OpenMode.ForWrite)
'遍历图块里的所有实体对象
Dim BlcokId As ObjectId
Dim objs As New Collection
For Each BlcokId In btrBlock
Dim BlockEntity As Entity = trans.GetObject(BlcokId, OpenMode.ForWrite)
If BlockEntity.GetType.Name = "RotatedDimension" Then
objs.Add(BlockEntity)
End If
Next
Dim frm As New frmDimension(objs)
frm.ShowDialog()
ed.WriteMessage("===============================================================\n")
End Sub
页:
[1]