怎样遍历文档中的对象
请教大家一下,我想遍历文档中的对象Sub GetLJCZData(ByVal doc As Document)
Dim acDoc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim acDatabase As Database = acDoc.Database
Using (acDoc.LockDocument)
Using trans As Transaction = acDatabase.TransactionManager.StartTransaction
Dim bt As BlockTable = trans.GetObject(acDatabase.BlockTableId, OpenMode.ForWrite)
Dim btr As BlockTableRecord = trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
For Each objId As ObjectId In btr
Dim ent As Entity = trans.GetObject(objId, OpenMode.ForWrite)
MsgBox(ent.GetType.Name)
Next
trans.Commit()
End Using
End Using
End Sub
我只会遍历块,但是有的对象是独立放在文档中的,没有组成块,这部分对象怎么获取?
你遍历的是模型空间,正是这一部分
页:
[1]