C3D-0148 · READ-ONLY: vicinity label + title block bounds [VIC-LABEL] done
Reports the VICINITY MAP label in paper space with its exact extents, position and height, the title block reference bounds the image must stay inside, and any raster already placed there. No changes.
C# payload
// READ-ONLY. Just the VICINITY MAP label in *Paper_Space and the title-block boundary, so the
// image can be placed over the label INSIDE the block. Nothing is modified.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ps = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.PaperSpace], OpenMode.ForRead);
Log("drawing: " + Db.Filename);
foreach (ObjectId id in ps) {
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 || s.ToUpper().IndexOf("VICINITY") < 0) continue;
var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)o;
var e = ent.GeometricExtents;
Log("LABEL [" + o.Handle + "] " + o.GetType().Name + " layer=" + ent.Layer);
Log(" text \"" + s + "\"");
Log(String.Format(" extents {0:F4},{1:F4} -> {2:F4},{3:F4} ({4:F3} wide x {5:F3} tall)",
e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y,
e.MaxPoint.X-e.MinPoint.X, e.MaxPoint.Y-e.MinPoint.Y));
if (dt != null) Log(String.Format(" position {0:F4},{1:F4} height {2:F4}", dt.Position.X, dt.Position.Y, dt.Height));
if (mt != null) Log(String.Format(" location {0:F4},{1:F4} height {2:F4}", mt.Location.X, mt.Location.Y, mt.TextHeight));
}
// the title block reference bounds = the page frame the image must stay inside
foreach (ObjectId id in ps) {
var br = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
if (br == null || br.Name.ToUpper().IndexOf("SS_BLOCK") < 0) continue;
var e = br.GeometricExtents;
Log("");
Log("TITLE BLOCK [" + br.Handle + "] " + br.Name);
Log(String.Format(" extents {0:F4},{1:F4} -> {2:F4},{3:F4}", e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y));
}
// anything already sitting near the label
Log("");
Log("=== existing rasters in *Paper_Space ===");
int n=0;
foreach (ObjectId id in ps) {
var ri = Tx.GetObject(id, OpenMode.ForRead) as RasterImage;
if (ri == null) continue;
n++;
var e = ri.GeometricExtents;
Log(String.Format(" [{0}] layer={1} {2:F3},{3:F3} -> {4:F3},{5:F3}",
ri.Handle, ri.Layer, e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y));
}
Log(" count: " + n);
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg LABEL [20955] DBText layer=BLOCK_CLOSURE text "VICINITY MAP (NOT TO SCALE)" extents 0.6579,3.3732 -> 1.9990,3.4601 (1.341 wide x 0.087 tall) position 0.6524,3.3922 height 0.0570 TITLE BLOCK [20355] SS_BLOCK_11X17 extents 0.1653,0.2874 -> 10.8150,16.7646 === existing rasters in *Paper_Space === count: 0
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.