How can I explode an AeccParcel object?
Solved! Go to Solution.
Solved by Alexey.Terno. Go to Solution.
Solved by hippe013. Go to Solution.
A base type of the Parcel is Entity which contains the explode method. Consider the following example.
<CommandMethod("TestExplode")> _ Public Sub TestExplode() Dim aDoc As Document = Application.DocumentManager.MdiActiveDocument Dim ed As Editor = aDoc.Editor Dim db As Database = aDoc.Database Dim opts As New PromptEntityOptions(vbCrLf + "Select Parcel") Dim res As PromptEntityResult = ed.GetEntity(opts) If res.Status = PromptStatus.OK Then Dim dbObjCol As New DBObjectCollection Dim BlkTbl As BlockTable Dim BlkTblRec As BlockTableRecord Using trans As Transaction = db.TransactionManager.StartTransaction Dim ent As Entity = trans.GetObject(res.ObjectId, OpenMode.ForWrite) BlkTbl = trans.GetObject(db.BlockTableId, OpenMode.ForRead) BlkTblRec = trans.GetObject(BlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) ent.Explode(dbObjCol) For Each XEnt As Entity In dbObjCol BlkTblRec.AppendEntity(XEnt) trans.AddNewlyCreatedDBObject(XEnt, True) Next trans.Commit() End Using End If End Sub
"Entity " is a .NET class and "AeccParcel" is COM object but I can convert old id to ObjectId:
ObjectId id = new ObjectId((IntPtr)parcel.ObjectID); Db.Parcel p = (Db.Parcel)_trans.GetObject(id, OpenMode.ForWrite); DBObjectCollection objs = new DBObjectCollection(); p.Explode(objs);
Thanks for the advice!