C3D-0043 · READ-ONLY: every Civil label by type, find the 36239.95 parent [ALL-CIVIL-LABELS] done
Civil labels store no text, so text search cannot find the 36239.95 annotation. Enumerates every Civil label in every block table record with its concrete type and parent, flags any parented to a parcel of area 36239.95, and lists every parcel in the drawing with its area. No changes.
C# payload
// READ-ONLY. The 36239.95 annotation stores no text (Civil labels compose text at draw time), so
// no text search can find it. Enumerate EVERY Civil label in every block table record, print its
// concrete type and its parent, and flag any parcel parent whose area is ~36239.95.
//
// Also list every parcel in the drawing with its area, because a parcel of that area must exist
// for the label to report it - earlier I only enumerated parcels via site.GetParcelIds().
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var typeCount = new Dictionary<string,int>();
int total = 0;
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
foreach (ObjectId id in btr) {
Autodesk.AutoCAD.DatabaseServices.DBObject o;
try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
var lbl = o as Autodesk.Civil.DatabaseServices.Label;
if (lbl == null) continue;
total++;
string tn = o.GetType().Name;
if (!typeCount.ContainsKey(tn)) typeCount[tn] = 0;
typeCount[tn]++;
// what is it attached to?
string ptype = "?", pinfo = "";
double parea = -1.0;
try {
var par = Tx.GetObject(lbl.FeatureId, OpenMode.ForRead);
ptype = par.GetType().Name;
var pp = par as Parcel;
if (pp != null) { parea = pp.Area; pinfo = " parcel=\"" + pp.Name + "\" area=" + parea.ToString("F2"); }
} catch { }
bool isTarget = parea > 36239.0 && parea < 36241.0;
if (!isTarget && tn.ToUpper().Contains("SEGMENT")) continue; // 34 segment tags already known
var ent = o as Autodesk.AutoCAD.DatabaseServices.Entity;
Log((isTarget ? ">>> TARGET " : " ") + "[" + o.Handle + "] " + tn
+ " btr=" + btr.Name + " layer=" + (ent != null ? ent.Layer : "?") + pinfo);
if (isTarget) {
try { Log(String.Format(" LabelLocation {0:F2},{1:F2}", lbl.LabelLocation.X, lbl.LabelLocation.Y)); } catch { }
try { Log(" StyleName " + lbl.StyleName); } catch { }
try { Log(" parent type " + ptype); } catch { }
}
}
}
Log("");
Log("civil labels total: " + total);
foreach (var kv in typeCount) Log(" " + kv.Key + " x" + kv.Value);
Log("");
Log("=== every parcel in the drawing ===");
var civil = CivilApplication.ActiveDocument;
foreach (ObjectId sid in civil.GetSiteIds()) {
var site = (Site)Tx.GetObject(sid, OpenMode.ForRead);
foreach (ObjectId pid in site.GetParcelIds()) {
var p = (Parcel)Tx.GetObject(pid, OpenMode.ForRead);
Log(String.Format(" site \"{0}\" [{1}] \"{2}\" area={3:F2}", site.Name, p.ObjectId.Handle, p.Name, p.Area));
}
}
Result
Log
[2E333] NoteLabel btr=*Model_Space layer=C-ANNO
[2E371] NoteLabel btr=*Model_Space layer=C-ANNO
[DD89] NoteLabel btr=A$Cb13f02df layer=C-ANNO
[F866] NoteLabel btr=A$C60c95c55 layer=C-ANNO
[113AE] NoteLabel btr=A$Cd95c20fb layer=C-ANNO
[11FED] NoteLabel btr=A$C691b1946 layer=C-ANNO
[12087] NoteLabel btr=A$Cd3c51b45 layer=C-ANNO
[14C48] NoteLabel btr=A$Ca665a447 layer=C-ANNO
[1547E] NoteLabel btr=A$C422bf1cf layer=C-ANNO
[1812E] NoteLabel btr=A$Cf7937ac2 layer=C-ANNO
[20E57] NoteLabel btr=A$C0470f833 layer=C-ANNO
[2197E] NoteLabel btr=A$C795156d6 layer=C-ANNO
[21AB4] NoteLabel btr=A$C5b88b541 layer=C-ANNO
[21B27] NoteLabel btr=A$C7f01e7ff layer=C-ANNO
[21B73] NoteLabel btr=A$C4bccf5b9 layer=C-ANNO
[2265E] NoteLabel btr=A$Ce4f12ff4 layer=C-ANNO
civil labels total: 54
ParcelSegmentLabel x37
NoteLabel x16
GeneralSegmentLabel x1
=== every parcel in the drawing ===
site "OG 20' EASEMENT" [2F0E0] "Basic : 5" area=11557.31
site "PROPERTY LINE" [2E1EC] "Property : 1" area=178277.49
site "SEWER EASEMENT" [2EE57] "30' S.S.E." area=24157.56
site "SEWER EASEMENT" [2EEDA] "20' S.S.E" area=12082.39Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.