C3D-0293 · 260612 C-Store: is the vicinity map over or under the label done
READ-ONLY. Compares the VICINITY MAP label extents against every raster and OLE frame on 22X17 to establish the actual vertical relationship.
C# payload
// Where is the vicinity map relative to the "VICINITY MAP" label on 22X17?
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
foreach (ObjectId btrId in bt) {
var rec = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
if (!rec.IsLayout) continue;
var lay = (Layout)Tx.GetObject(rec.LayoutId, OpenMode.ForRead);
if (lay.LayoutName != "22X17") continue;
Extents3d? lbl = null;
foreach (ObjectId id in rec) {
var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null) continue;
var dt = ent as DBText;
if (dt != null && dt.TextString.ToUpper().Contains("VICINITY")) {
var e = dt.GeometricExtents; lbl = e;
Log(string.Format("LABEL [{0}] \"{1}\" ({2:F4},{3:F4})-({4:F4},{5:F4})",
dt.Handle, dt.TextString, e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y));
}
}
foreach (ObjectId id in rec) {
var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null) continue;
var ri = ent as RasterImage;
var ol = ent as Ole2Frame;
if (ri == null && ol == null) continue;
var e = ent.GeometricExtents;
string kind = ri != null ? "RASTER" : "OLE";
Log(string.Format("{0} [{1}] ({2:F4},{3:F4})-({4:F4},{5:F4}) {6:F2} x {7:F2} layer={8}",
kind, ent.Handle, e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y,
e.MaxPoint.X-e.MinPoint.X, e.MaxPoint.Y-e.MinPoint.Y, ent.Layer));
if (ri != null) {
var d = (RasterImageDef)Tx.GetObject(ri.ImageDefId, OpenMode.ForRead);
Log(" def: " + d.SourceFileName + " loaded=" + d.IsLoaded);
}
if (lbl != null) {
var L = lbl.Value;
bool overlapsX = e.MinPoint.X < L.MaxPoint.X && e.MaxPoint.X > L.MinPoint.X;
bool overlapsY = e.MinPoint.Y < L.MaxPoint.Y && e.MaxPoint.Y > L.MinPoint.Y;
Log(string.Format(" vs label: image bottom {0:F4}, label top {1:F4} -> image is {2}",
e.MinPoint.Y, L.MaxPoint.Y,
(overlapsX && overlapsY) ? "COVERING THE LABEL" :
(e.MinPoint.Y >= L.MaxPoint.Y ? "ABOVE the label" : "BELOW the label")));
}
}
}
Result
Log
LABEL [2EC14] "VICINITY MAP (NOT TO SCALE)" (17.9519,8.8812)-(19.2930,8.9681)
RASTER [2EC1F] (17.4735,9.0462)-(21.4344,13.0071) 3.96 x 3.96 layer=BLOCK_CLOSURE
def: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity-map.png loaded=True
vs label: image bottom 9.0462, label top 8.9681 -> image is ABOVE the labelNotes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.