← Inbox

C3D-0176 · READ-ONLY: the land lot line annotation and the line it labels [LL-FIND] done

Finds the LAND LOT text in this drawing model space with its position, height and rotation, then lists every line and polyline whose midpoint is within 250 feet of it with full endpoint coordinates, to identify the land lot line the markers must straddle. No changes.

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

C# payload

// READ-ONLY. Find the APPROXIMATE LAND LOT LINE annotation in THIS drawing and the line it labels.
// Model space only, no attribute definitions, no legend. Then report every line/polyline whose
// midpoint is within 200 ft of that text, so the land lot line itself is identified.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Log("drawing: " + Db.Filename);

double tx = 0, ty = 0; bool found = false;
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;
    string u = s.ToUpper();
    if (u.IndexOf("LAND LOT") < 0) continue;
    var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)o;
    var p = mt != null ? mt.Location : dt.Position;
    tx = p.X; ty = p.Y; found = true;
    Log("TEXT [" + o.Handle + "] " + o.GetType().Name + " layer=" + ent.Layer);
    Log("   \"" + s.Replace("\n", " | ") + "\"");
    Log(String.Format("   at {0:F3},{1:F3}  h={2:F3} rot={3:F2}",
        p.X, p.Y, mt != null ? mt.TextHeight : dt.Height,
        (mt != null ? mt.Rotation : dt.Rotation) * 180.0 / Math.PI));
}
if (!found) { Log("no LAND LOT text in model space of this drawing"); return; }

Log("");
Log("=== lines / polylines near that text (within 250 ft) ===");
foreach (ObjectId id in ms) {
    Autodesk.AutoCAD.DatabaseServices.DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    var ln = o as Line;
    var pl = o as Polyline;
    if (ln == null && pl == null) continue;
    var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)o;

    double mx, my, len;
    if (ln != null) {
        mx = (ln.StartPoint.X + ln.EndPoint.X)/2; my = (ln.StartPoint.Y + ln.EndPoint.Y)/2; len = ln.Length;
    } else {
        var a = pl.GetPoint2dAt(0); var b = pl.GetPoint2dAt(pl.NumberOfVertices-1);
        mx = (a.X + b.X)/2; my = (a.Y + b.Y)/2; len = pl.Length;
    }
    double d = Math.Sqrt((mx-tx)*(mx-tx) + (my-ty)*(my-ty));
    if (d > 250) continue;
    Log(String.Format("  [{0}] {1,-9} layer={2,-24} len={3,8:F2} mid {4:F2},{5:F2}  {6:F1} ft from text",
        o.Handle, o.GetType().Name, ent.Layer, len, mx, my, d));
    if (ln != null)
        Log(String.Format("        {0:F3},{1:F3} -> {2:F3},{3:F3}",
            ln.StartPoint.X, ln.StartPoint.Y, ln.EndPoint.X, ln.EndPoint.Y));
    if (pl != null)
        for (int i = 0; i < pl.NumberOfVertices && i < 8; 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-0176 (0 entities touched).
Entities
Duration
972 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
no LAND LOT text in model space of this drawing

Notes

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

No notes yet.