← Inbox

C3D-0040 · READ-ONLY: locate the SEWER EASEMENT 36239.95 annotation [FIND-SSE-ANNO] error

Walks every model-space entity with no type or layer filter, matching on the text 36239 / 0.83 / SEWER EASEMENT, and reports the matched object type, layer, position, style and parent parcel. No changes.

Script file
C3D-0040.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.
//
// Do NOT filter by type or layer this time - my earlier scans filtered on both and missed it.
// Walk EVERY entity in model space, pull whatever text it exposes, and match on the number.
// Then report exactly what it is and what holds it. Nothing is modified.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);

Func<DBObject, string> textOf = o => {
    var mt = o as MText;   if (mt != null) return mt.Contents;
    var dt = o as DBText;  if (dt != null) return dt.TextString;
    var lb = o as Autodesk.Civil.DatabaseServices.Label;
    if (lb != null) { try { return lb.GetTextComponentValue(); } catch { return "<label>"; } }
    return null;
};

int scanned = 0, hits = 0;
foreach (ObjectId id in ms) {
    DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    scanned++;
    string s = null;
    try { s = textOf(o); } catch { }
    if (s == null) continue;
    if (s.IndexOf("36239") < 0 && s.IndexOf("0.83") < 0 && s.ToUpper().IndexOf("SEWER EASEMENT") < 0) 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 : "?"));
    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 { }
    }
    var lbl = o as Autodesk.Civil.DatabaseServices.Label;
    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
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg
Message
Compile error: (8,6): error CS0104: 'DBObject' is an ambiguous reference between 'Autodesk.AutoCAD.DatabaseServices.DBObject' and 'Autodesk.Civil.DatabaseServices.DBObject'; (12,39): error CS1061: 'Label' does not contain a definition for 'GetTextComponentValue' and no accessible extension method 'GetTextComponentValue' accepting a first argument of type 'Label' could be found (are you missing a using directive or an assembly reference?); (18,5): error CS0104: 'DBObject' is an ambiguous reference between 'Autodesk.AutoCAD.DatabaseServices.DBObject' and 'Autodesk.Civil.DatabaseServices.DBObject'
Entities
Duration
423 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.