C3D-0370 · READ-ONLY: what is the single entity on AecObjExplode_22X17_Pspace [C3D-AECWHAT] done
Identifies the one remaining entity on AecObjExplode_22X17_Pspace - its type, owning space, extents, and type-specific detail (text, block name, vertex count or length).
C# payload
// READ-ONLY. Identify the single entity on AecObjExplode_22X17_Pspace.
Log("drawing: " + Db.Filename);
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
string space = btr.Name;
foreach (ObjectId id in btr) {
var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null) continue;
if (!e.Layer.Equals("AecObjExplode_22X17_Pspace", StringComparison.OrdinalIgnoreCase)) continue;
Autodesk.AutoCAD.DatabaseServices.Extents3d ex;
try { ex = e.GeometricExtents; } catch { ex = new Autodesk.AutoCAD.DatabaseServices.Extents3d(); }
string extra = "";
var mt=e as MText; var dt=e as DBText; var br=e as BlockReference; var pl=e as Polyline; var ln=e as Line;
if (mt!=null) extra="text=\""+mt.Contents+"\"";
else if (dt!=null) extra="text=\""+dt.TextString+"\"";
else if (br!=null) extra="block="+((BlockTableRecord)Tx.GetObject(br.BlockTableRecord,OpenMode.ForRead)).Name;
else if (pl!=null) extra="verts="+pl.NumberOfVertices+" closed="+pl.Closed+" len="+pl.Length.ToString("F2");
else if (ln!=null) extra="len="+ln.Length.ToString("F2");
Log(string.Format("[{0}] {1} space={2} ({3:F2},{4:F2})-({5:F2},{6:F2}) {7}",
e.Handle, e.GetType().Name, space, ex.MinPoint.X, ex.MinPoint.Y, ex.MaxPoint.X, ex.MaxPoint.Y, extra));
}
}
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\ACAD-260612-Springdale Sanitary Sewer Extension As-Built 60 wPROFILE.dwg [1FC8] BlockReference space=*Paper_Space (100000000000000000000.00,100000000000000000000.00)-(-100000000000000000000.00,-100000000000000000000.00) block=AecObjExplode_22X17_Pspace
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.