C3D-0596 · Read surfaces and boundary done
Read-only: list surfaces (name, layer, extents, boundary definitions) and boundary polylines.
C# payload
foreach(ObjectId sid in CivilDoc.GetSurfaceIds()){
var s=Tx.GetObject(sid,OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.TinSurface;
var sb=Tx.GetObject(sid,OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Surface;
Log("SURFACE '"+sb.Name+"' type="+sb.GetType().Name+" layer="+sb.Layer+" h="+sb.Handle+" style="+((Autodesk.AutoCAD.DatabaseServices.DBObject)Tx.GetObject(sb.StyleId,OpenMode.ForRead)).GetType().Name);
if(s!=null){
var p=s.GetGeneralProperties(); Log(" pts="+p.NumberOfPoints+" ext=("+p.MinimumCoordinateX.ToString("F1")+","+p.MinimumCoordinateY.ToString("F1")+")-("+p.MaximumCoordinateX.ToString("F1")+","+p.MaximumCoordinateY.ToString("F1")+")");
Log(" boundaries="+s.BoundariesDefinition.Count);
for(int i=0;i<s.BoundariesDefinition.Count;i++){ var b=s.BoundariesDefinition[i]; Log(" ["+i+"] "+b.BoundaryType+" name="+b.Name); }
}
}
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForRead);
foreach(ObjectId id in ms){ var pl=Tx.GetObject(id,OpenMode.ForRead) as Polyline; if(pl!=null && pl.Layer.ToUpper().Contains("BOUNDARY")) Log("BOUNDARY POLY h="+pl.Handle+" layer="+pl.Layer+" nv="+pl.NumberOfVertices+" closed="+pl.Closed+" area="+pl.Area.ToString("F0")); }
Result
Log
SURFACE 'TOPO' type=TinSurface layer=C-TOPO h=21296 style=SurfaceStyle pts=122 ext=(2333712.4,1491866.5)-(2333950.3,1492104.8) boundaries=0 BOUNDARY POLY h=20F9E layer=X-BOUNDARY nv=6 closed=True area=15001
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.