← Inbox

C3D-0595 · Read surfaces and boundary error

Read-only: list surfaces (name, layer, extents, boundary definitions) and boundary polylines.

Script file
C3D-0595.cs
Target
261001 - 5040 Rolling Rock Dr.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

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+" nonDestructive="+b.NonDestructive+" 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

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261001 - 5040 Rolling Rock Dr, Sugar Hill, GA 30518, USA\261001 - 5040 Rolling Rock Dr.dwg
Message
Compile error: (8,142): error CS1061: 'SurfaceOperationAddBoundary' does not contain a definition for 'NonDestructive' and no accessible extension method 'NonDestructive' accepting a first argument of type 'SurfaceOperationAddBoundary' could be found (are you missing a using directive or an assembly reference?)
Entities
—
Duration
350 ms
Civil 3D
25.0.0.0

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.