← Inbox

C3D-0175 · READ-ONLY: existing L.L. marker and the land lot line [LL-MARKER] done

Finds the existing L.L. circle marker with its text, circle radius and layer, any block named for a land lot marker, and the land lot line geometry, so a matching pair of markers can be placed either side of the line. No changes.

Script file
C3D-0175.cs
Target
active document · model space
Author
claude
Approved
yes · reviewer
Timeout
240s

C# payload

// READ-ONLY. Find the existing "L.L. <n>" circle marker so a matching pair can be built, and find
// the land lot LINE itself so the two new markers can be placed on either side of it.
// Nothing is modified.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Log("drawing: " + Db.Filename);

Log("=== text containing L.L. in model space ===");
foreach (ObjectId id in ms) {
    Autodesk.AutoCAD.DatabaseServices.DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    string s = null;
    var mt = o as MText;  if (mt != null) s = mt.Contents;
    var dt = o as DBText; if (dt != null) s = dt.TextString;
    if (s == null) continue;
    if (s.ToUpper().IndexOf("L.L") < 0) continue;
    var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)o;
    Log("  [" + o.Handle + "] " + o.GetType().Name + " layer=" + ent.Layer + "  \"" + s.Replace("\n"," | ") + "\"");
    if (mt != null) Log(String.Format("      at {0:F3},{1:F3} h={2:F3}", mt.Location.X, mt.Location.Y, mt.TextHeight));
    if (dt != null) Log(String.Format("      at {0:F3},{1:F3} h={2:F3}", dt.Position.X, dt.Position.Y, dt.Height));
}

Log("");
Log("=== circles in model space (the marker ring) ===");
int nc = 0;
foreach (ObjectId id in ms) {
    var c = Tx.GetObject(id, OpenMode.ForRead) as Circle;
    if (c == null) continue;
    nc++;
    if (nc <= 25)
        Log(String.Format("  [{0}] centre {1:F3},{2:F3} r={3:F3} layer={4}",
            c.Handle, c.Center.X, c.Center.Y, c.Radius, c.Layer));
}
Log("  circles total: " + nc);

Log("");
Log("=== blocks whose name suggests a land lot marker ===");
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
    string u = btr.Name.ToUpper();
    if (u.IndexOf("LL") < 0 && u.IndexOf("LAND") < 0 && u.IndexOf("LOT") < 0) continue;
    var refs = btr.GetBlockReferenceIds(true, true);
    Log("  \"" + btr.Name + "\"  inserted " + refs.Count + " time(s)");
}

Log("");
Log("=== entities on SS-BOUNDARY LAND LOT (the line) ===");
foreach (ObjectId id in ms) {
    Autodesk.AutoCAD.DatabaseServices.DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    var ent = o as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null) continue;
    string lay; try { lay = ent.Layer; } catch { continue; }
    if (lay.ToUpper().IndexOf("LAND LOT") < 0) continue;
    Log("  [" + o.Handle + "] " + o.GetType().Name + " on " + lay);
    var ln = o as Line;
    if (ln != null) Log(String.Format("      {0:F3},{1:F3} -> {2:F3},{3:F3}  len={4:F2}",
        ln.StartPoint.X, ln.StartPoint.Y, ln.EndPoint.X, ln.EndPoint.Y, ln.Length));
    var pl = o as Polyline;
    if (pl != null) {
        Log(String.Format("      verts={0} len={1:F2}", pl.NumberOfVertices, pl.Length));
        for (int i = 0; i < pl.NumberOfVertices && i < 12; i++) {
            var v = pl.GetPoint2dAt(i);
            Log(String.Format("        v{0} {1:F3},{2:F3}", i, v.X, v.Y));
        }
    }
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-C-Store Sewer As-Built.dwg
Message
Executed C3D-0175 (0 entities touched).
Entities
Duration
591 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 Sewer As-Built.dwg
=== text containing L.L. in model space ===

=== circles in model space (the marker ring) ===
  [2DECC] centre 2297923.171,1277604.047 r=1.021 layer=PDF2_SWM
  [2DECD] centre 2297923.171,1277604.047 r=2.021 layer=PDF2_SWM
  [2E1A3] centre 2296550.245,1279802.050 r=0.938 layer=PDF2_E IPF-SET
  [2E1A4] centre 2296550.245,1279802.050 r=1.271 layer=PDF2_E IPF-SET
  [2E1A5] centre 2296407.718,1279740.413 r=0.938 layer=PDF2_E IPF-SET
  [2E1A6] centre 2296407.718,1279740.413 r=1.271 layer=PDF2_E IPF-SET
  [2E1A7] centre 2296318.993,1279740.497 r=0.938 layer=PDF2_E IPF-SET
  [2E1A8] centre 2296318.993,1279740.497 r=1.271 layer=PDF2_E IPF-SET
  [2E1A9] centre 2296368.711,1279891.650 r=0.938 layer=PDF2_E IPF-SET
  [2E1AA] centre 2296368.711,1279891.650 r=1.271 layer=PDF2_E IPF-SET
  [2E1AB] centre 2296385.922,1280000.171 r=0.938 layer=PDF2_E IPF-SET
  [2E1AC] centre 2296385.922,1280000.171 r=1.271 layer=PDF2_E IPF-SET
  [2FA74] centre 2296407.583,1279747.451 r=0.938 layer=SS-0-FRAME
  [2FA75] centre 2296407.583,1279747.451 r=1.271 layer=SS-0-FRAME
  circles total: 14

=== blocks whose name suggests a land lot marker ===
  "Well"  inserted 0 time(s)
  "Drill Hole"  inserted 0 time(s)
  "_ClosedFilled"  inserted 0 time(s)
  "FullSuperLeftDownEmpty"  inserted 0 time(s)
  "FullSuperLeftUpEmpty"  inserted 0 time(s)
  "FullSuperRightUpEmpty"  inserted 0 time(s)
  "FullSuperRightDownEmpty"  inserted 0 time(s)
  "AeccArwClosedFilled"  inserted 0 time(s)

=== entities on SS-BOUNDARY LAND LOT (the line) ===

Notes

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

No notes yet.