C3D-VICFIND2 · Locate VICINITY MAP text in paper space (read-only) done
Find the vicinity map label + any existing rasters
C# payload
// Read-only: locate "VICINITY MAP" text in paper space + report its position/height and the
// empty area above it, so a raster image can be placed correctly.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
string where = btr.Name;
if (btr.IsLayout) { var lay = (Layout)Tx.GetObject(btr.LayoutId, OpenMode.ForRead); where = "LAYOUT '" + lay.LayoutName + "'"; }
foreach (ObjectId id in btr) {
var o = Tx.GetObject(id, OpenMode.ForRead);
string s = null;
if (o is MText mt) s = mt.Contents;
else if (o is DBText t) s = t.TextString;
else if (o is BlockReference br && br.AttributeCollection != null) {
foreach (ObjectId aid in br.AttributeCollection) {
var ar = (AttributeReference)Tx.GetObject(aid, OpenMode.ForRead);
if ((ar.TextString ?? "").ToUpperInvariant().Contains("VICINITY")) {
var d2 = (BlockTableRecord)Tx.GetObject(br.DynamicBlockTableRecord, OpenMode.ForRead);
Log($"[{where}] BLOCK '{d2.Name}' ATTR '{ar.Tag}' = \"{ar.TextString}\" @({ar.Position.X:F2},{ar.Position.Y:F2}) h={ar.Height:F2}");
}
}
continue;
}
if (s == null || !s.ToUpperInvariant().Contains("VICINITY")) continue;
var e = (Autodesk.AutoCAD.DatabaseServices.Entity)o;
if (o is MText m2) Log($"[{where}] MText handle={e.Handle} layer={e.Layer} @({m2.Location.X:F3},{m2.Location.Y:F3}) h={m2.TextHeight:F3} attach={m2.Attachment} :: \"{m2.Contents}\"");
else if (o is DBText t2) Log($"[{where}] DBText handle={e.Handle} layer={e.Layer} @({t2.Position.X:F3},{t2.Position.Y:F3}) h={t2.Height:F3} just={t2.Justify} :: \"{t2.TextString}\"");
}
}
// also report existing raster images so we match convention / avoid duplicates
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
string where = btr.Name;
if (btr.IsLayout) { var lay = (Layout)Tx.GetObject(btr.LayoutId, OpenMode.ForRead); where = "LAYOUT '" + lay.LayoutName + "'"; }
foreach (ObjectId id in btr) {
var o = Tx.GetObject(id, OpenMode.ForRead);
if (o is RasterImage ri) {
var e = (Autodesk.AutoCAD.DatabaseServices.Entity)o;
Log($"[{where}] RASTER handle={e.Handle} layer={e.Layer} size=({ri.Width:F2}x{ri.Height:F2}) orient={ri.Orientation}");
}
}
}
Log("Vicinity scan complete.");
Result
Log
[LAYOUT '11X17'] DBText handle=20955 layer=BLOCK_CLOSURE @(0.652,3.392) h=0.057 just=BaseLeft :: "VICINITY MAP (NOT TO SCALE)" [LAYOUT 'HOUSEDIM'] DBText handle=1E807 layer=SS-BOUNDARY LAND LOT @(1.177,3.595) h=0.076 just=BaseLeft :: "VICINITY MAP (NOT TO SCALE)" [SS_BLOCK_11X17 (1)] DBText handle=1FF47 layer=BLOCK_TB2 @(-10.168,3.107) h=0.076 just=BaseLeft :: "VICINITY MAP (NOT TO SCALE)" [SS_BLOCK_11X17 (2)] DBText handle=1FFCA layer=BLOCK_TB2 @(-10.168,3.107) h=0.076 just=BaseLeft :: "VICINITY MAP (NOT TO SCALE)" [SS_BLOCK_11X17 (3)] DBText handle=2007B layer=BLOCK_TB2 @(-10.168,3.107) h=0.076 just=BaseLeft :: "VICINITY MAP (NOT TO SCALE)" [LAYOUT 'Model'] RASTER handle=1D6A6 layer=SS-V-ROAD-CURB size=(93.71x93.71) orient=((2226412.8058409803,1346196.1253498904,1192.743799999822),(93.71449999976903,0,0),(0,93.71449999976903,0),(0,0,8782.407510206709)) [_Wipeout_Circle] RASTER handle=1DAC layer=0 size=(1.00x1.00) orient=((-0.4990133642141341,-0.496057350657237,0),(0.99802672842827,0,0),(0,0.99802672842827,0),(0,0,0.9960573506572358)) [_TagCircle] RASTER handle=1240A layer=0 size=(0.25x0.25) orient=((-0.125,-0.125,0),(0.25,0,0),(0,0.25,0),(0,0,0.0625)) Vicinity scan complete.
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.