← Inbox

C3D-0041 · READ-ONLY: locate the SEWER EASEMENT 36239.95 annotation [FIND-SSE-ANNO2] done

Walks every model-space entity with no type or layer filter, matching text on 36239 / 0.83 / SEWER EASEMENT and also reporting every area-type Civil label, with type, layer, position, style and parent parcel. No changes.

Script file
C3D-0041.cs
Target
260612 · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// READ-ONLY. Find the "SEWER EASEMENT / 36239.95 SQ FT / 0.83 ACRES" annotation.
//
// No type or layer filter - my earlier scans filtered on both and missed it. Walk EVERY entity in
// model space, pull whatever text it exposes, match on the number, then report what it is and what
// holds it.
//
// Notes to self: DBObject is ambiguous (AutoCAD vs Civil) - fully qualify it, same trap as Entity.
// Civil Label has no GetTextComponentValue; for labels fall back to the exploded text or just
// report the type, rather than guessing another member name.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);

int scanned = 0, hits = 0;
foreach (ObjectId id in ms) {
    Autodesk.AutoCAD.DatabaseServices.DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    scanned++;

    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;
    var lbl = o as Autodesk.Civil.DatabaseServices.Label;

    bool match = false;
    if (s != null) {
        string u = s.ToUpper();
        match = u.Contains("36239") || u.Contains("0.83") || u.Contains("SEWER EASEMENT");
    }
    // Civil labels hide their text, so also report EVERY parcel-area-ish label for inspection.
    bool areaLabelish = lbl != null && lbl.GetType().Name.ToUpper().Contains("AREA");
    if (!match && !areaLabelish) continue;

    hits++;
    var ent = o as Autodesk.AutoCAD.DatabaseServices.Entity;
    Log("");
    Log("HIT [" + o.Handle + "]  type=" + o.GetType().FullName);
    Log("   layer  " + (ent != null ? ent.Layer : "?"));
    if (s != null) Log("   text   " + s.Replace("\n", " | "));
    if (ent != null) {
        try { var e = ent.GeometricExtents; Log(String.Format("   at     {0:F2},{1:F2}", e.MinPoint.X, e.MinPoint.Y)); } catch { }
    }
    if (lbl != null) {
        try { Log(String.Format("   LabelLocation {0:F2},{1:F2}", lbl.LabelLocation.X, lbl.LabelLocation.Y)); } catch { }
        try { Log("   StyleName " + lbl.StyleName); } catch { }
        try {
            var par = Tx.GetObject(lbl.FeatureId, OpenMode.ForRead);
            string extra = "";
            var pp = par as Parcel;
            if (pp != null) extra = "  name=\"" + pp.Name + "\" area=" + pp.Area.ToString("F2");
            Log("   PARENT [" + par.Handle + "] " + par.GetType().Name + extra);
        } catch (System.Exception ex) { Log("   PARENT: " + ex.Message); }
    }
}
Log("");
Log("scanned " + scanned + " model-space entities, matched " + hits);

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg
Message
Executed C3D-0041 (0 entities touched).
Entities
Duration
385 ms
Civil 3D
25.0.0.0

Log


scanned 12798 model-space entities, matched 0

Notes

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

No notes yet.