← Inbox

C3D-0387 · READ-ONLY: what layer are the grease-trap symbols + label on [C3D-GT2] done

Finds the GREASE TRAPS label and reports its layer, then lists the circles and block inserts within 200 ft of it (the double-circle grease-trap symbols) with their layers.

Script file
C3D-0387.cs
Target
260612-C-Store As-Built 60 H2O.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// The "PROP. 1500 GAL GREASE TRAPS" callout points at two side-by-side double-circle symbols.
// Find the label, then find the circles/blocks near where its leader points, and report layers.
Log("drawing: " + Db.Filename);
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);

// the label
Point3d lblPt = Point3d.Origin; bool found=false;
foreach (ObjectId id in ms){
    var o=Tx.GetObject(id,OpenMode.ForRead); var mt=o as MText; var dt=o as DBText;
    string t=mt!=null?mt.Contents:(dt!=null?dt.TextString:"");
    if (t.ToUpper().Contains("GREASE")){
        var e=(Autodesk.AutoCAD.DatabaseServices.Entity)o;
        var p = mt!=null?mt.Location:dt.Position;
        Log(string.Format("LABEL [{0}] layer={1} at ({2:F2},{3:F2}) \"{4}\"", e.Handle, e.Layer, p.X, p.Y, t.Replace("\n"," ")));
        lblPt=p; found=true;
    }
}
if(!found){ Log("no GREASE label found"); }

// double-circle symbols: block inserts whose def contains 2 concentric circles, and any circles
// near the label. Report by layer.
Log("");
Log("=== circles + inserts in the vicinity (within 200 ft of the label) ===");
foreach (ObjectId id in ms){
    var e=Tx.GetObject(id,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e==null) continue;
    var c=e as Circle; var br=e as BlockReference;
    Point3d p;
    if (c!=null) p=c.Center;
    else if (br!=null) p=br.Position;
    else continue;
    if (found && p.DistanceTo(lblPt) > 200) continue;
    if (c!=null) Log(string.Format("  CIRCLE [{0}] layer={1} r={2:F2} at ({3:F1},{4:F1})", e.Handle, e.Layer, c.Radius, p.X, p.Y));
    else { var def=(BlockTableRecord)Tx.GetObject(br.BlockTableRecord,OpenMode.ForRead); Log(string.Format("  INSERT [{0}] block=\"{1}\" layer={2} at ({3:F1},{4:F1})", e.Handle, def.Name, e.Layer, p.X, p.Y)); }
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-C-Store As-Built 60 H2O.dwg
Message
Executed C3D-0387 (0 entities touched).
Entities
Duration
541 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-C-Store As-Built 60 H2O.dwg
no GREASE label found

=== circles + inserts in the vicinity (within 200 ft of the label) ===
  CIRCLE [2DECC] layer=PDF2_SWM r=1.02 at (2297923.2,1277604.0)
  CIRCLE [2DECD] layer=PDF2_SWM r=2.02 at (2297923.2,1277604.0)
  CIRCLE [2E1A3] layer=PDF2_E IPF-SET r=0.94 at (2296550.2,1279802.0)
  CIRCLE [2E1A4] layer=PDF2_E IPF-SET r=1.27 at (2296550.2,1279802.0)
  CIRCLE [2E1A5] layer=PDF2_E IPF-SET r=0.94 at (2296407.7,1279740.4)
  CIRCLE [2E1A6] layer=PDF2_E IPF-SET r=1.27 at (2296407.7,1279740.4)
  CIRCLE [2E1A7] layer=PDF2_E IPF-SET r=0.94 at (2296319.0,1279740.5)
  CIRCLE [2E1A8] layer=PDF2_E IPF-SET r=1.27 at (2296319.0,1279740.5)
  CIRCLE [2E1A9] layer=PDF2_E IPF-SET r=0.94 at (2296368.7,1279891.7)
  CIRCLE [2E1AA] layer=PDF2_E IPF-SET r=1.27 at (2296368.7,1279891.7)
  CIRCLE [2E1AB] layer=PDF2_E IPF-SET r=0.94 at (2296385.9,1280000.2)
  CIRCLE [2E1AC] layer=PDF2_E IPF-SET r=1.27 at (2296385.9,1280000.2)
  CIRCLE [3002B] layer=PDF2_E IPF-SET r=0.94 at (2296945.9,1280252.5)
  CIRCLE [3002C] layer=PDF2_E IPF-SET r=1.27 at (2296945.9,1280252.5)
  CIRCLE [30035] layer=PDF2_E IPF-SET r=0.94 at (2296420.4,1280257.8)
  CIRCLE [30036] layer=PDF2_E IPF-SET r=1.27 at (2296420.4,1280257.8)
  CIRCLE [3003F] layer=PDF2_E IPF-SET r=0.94 at (2296386.0,1280224.5)
  CIRCLE [30040] layer=PDF2_E IPF-SET r=1.27 at (2296386.0,1280224.5)
  CIRCLE [30087] layer=LAND_LOT_LINE_TEXT r=9.38 at (2296379.0,1279819.9)
  CIRCLE [30088] layer=LAND_LOT_LINE_TEXT r=12.71 at (2296379.0,1279819.9)
  CIRCLE [3008A] layer=LAND_LOT_LINE_TEXT r=9.38 at (2296429.0,1279819.9)
  CIRCLE [3008B] layer=LAND_LOT_LINE_TEXT r=12.71 at (2296429.0,1279819.9)

Notes

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

No notes yet.