C3D-READA · Read TRACT A boundary geometry (read-only) done
Get TRACT A outline: any polyline on SS-BOUNDARY TRACT A, all entities on it, and the parcel exploded to segments. To build A's hero layer.
C# payload
// READ-ONLY: get TRACT A boundary geometry. It's a Parcel on SS-BOUNDARY TRACT A.
// Try (1) any Polyline on that layer (like B had); (2) the Parcel exploded; (3) parcel curve ids.
// Report vertex/segment coords so we can rebuild a bold polyline on a hero layer.
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;
var db = Db;
const string A_LAYER = "SS-BOUNDARY TRACT A";
using (var tr = db.TransactionManager.StartTransaction())
{
var ms=(BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db),OpenMode.ForRead);
// (1) polyline directly on the layer?
int poly=0;
foreach(ObjectId id in ms){ var e=tr.GetObject(id,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if(e is Polyline pl && string.Equals(e.Layer,A_LAYER,StringComparison.OrdinalIgnoreCase)){
poly++; Log($"POLYLINE on {A_LAYER}: verts={pl.NumberOfVertices} closed={pl.Closed} len={pl.Length:0.0}");
for(int i=0;i<pl.NumberOfVertices;i++){ var p=pl.GetPoint3dAt(i); Log($" v{i}: {p.X:0.000},{p.Y:0.000}"); }
}
// also list ALL entity types on this layer so we see what A actually is
}
if(poly==0) Log($"no direct Polyline on {A_LAYER}");
// list every entity on the A layer
Log($"ALL entities on {A_LAYER}:");
foreach(ObjectId id in ms){ var e=tr.GetObject(id,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if(e!=null && string.Equals(e.Layer,A_LAYER,StringComparison.OrdinalIgnoreCase)) Log($" {e.GetType().Name} h={e.Handle}");
}
// (2)(3) the Parcel: try to get its boundary curves
var cdoc=CivilDocument.GetCivilDocument(db);
foreach(ObjectId sid in cdoc.GetSiteIds()){var site=(Site)tr.GetObject(sid,OpenMode.ForRead);
foreach(ObjectId pid in site.GetParcelIds()){var p=(Parcel)tr.GetObject(pid,OpenMode.ForRead);
if(!string.Equals(p.Layer,A_LAYER,StringComparison.OrdinalIgnoreCase))continue;
Log($"PARCEL '{p.Name}' area={p.Area/43560.0:0.000}ac");
// explode attempt
var col=new DBObjectCollection(); int ex=0;
try{ p.Explode(col); }catch(System.Exception e){ Log($" explode err: {e.Message}"); }
foreach(Autodesk.AutoCAD.DatabaseServices.DBObject o in col){
ex++;
if(o is Line l) Log($" seg Line ({l.StartPoint.X:0.0},{l.StartPoint.Y:0.0})->({l.EndPoint.X:0.0},{l.EndPoint.Y:0.0}) len={l.Length:0.0}");
else if(o is Arc a) Log($" seg Arc c=({a.Center.X:0.0},{a.Center.Y:0.0}) r={a.Radius:0.0} len={a.Length:0.0}");
else if(o is Polyline pp) Log($" seg Polyline verts={pp.NumberOfVertices} len={pp.Length:0.0}");
else Log($" seg {o.GetType().Name}");
}
Log($" explode produced {ex} objects");
}}
tr.Commit();
}
Result
Log
no direct Polyline on SS-BOUNDARY TRACT A ALL entities on SS-BOUNDARY TRACT A: Parcel h=2106A PARCEL 'TRACT "A"' area=0.994ac seg Hatch seg MText seg Polyline verts=4 len=192.0 explode produced 3 objects
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.