C3D-0361 · READ-ONLY: is the vicinity map in this drawing? find raster images + VICINITY text [C3D-VICCHK] done
Scans model space and every layout for RasterImage entities (reporting handle, space, layer, extents and source file) and for any text containing 'VICINITY', then lists the drawing's image definitions. Determines whether a vicinity map exists here and where it sits.
C# payload
// READ-ONLY. Every RasterImage / image definition and any "vicinity" text, in model space and
// every layout, so we know if a vicinity map lives in this drawing and where.
Log("drawing: " + Db.Filename);
System.Action<BlockTableRecord,string> scan = (btr, space) => {
foreach (ObjectId id in btr) {
var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null) continue;
var img = e as RasterImage;
if (img != null) {
Autodesk.AutoCAD.DatabaseServices.Extents3d ex;
try { ex = img.GeometricExtents; } catch { ex = new Autodesk.AutoCAD.DatabaseServices.Extents3d(); }
string defName = "";
try {
var def = (RasterImageDef)Tx.GetObject(img.ImageDefId, OpenMode.ForRead);
defName = def.SourceFileName;
} catch { }
Log(string.Format("[{0}] RasterImage space={1} layer={2} ({3:F2},{4:F2})-({5:F2},{6:F2}) src=\"{7}\"",
img.Handle, space, img.Layer, ex.MinPoint.X, ex.MinPoint.Y, ex.MaxPoint.X, ex.MaxPoint.Y, defName));
}
var mt = e as MText; var dt = e as DBText;
string t = mt != null ? mt.Contents : (dt != null ? dt.TextString : "");
if (t.IndexOf("VICINITY", StringComparison.OrdinalIgnoreCase) >= 0) {
var p = mt != null ? mt.Location : dt.Position;
Log(string.Format("[{0}] {1} space={2} layer={3} ({4:F2},{5:F2}) \"{6}\"",
e.Handle, e.GetType().Name, space, e.Layer, p.X, p.Y, t.Replace("\n"," ")));
}
}
};
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
scan(ms, "model");
var dict = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry de in dict) {
if (de.Key == "Model") continue;
var lay = (Layout)Tx.GetObject(de.Value, OpenMode.ForRead);
scan((BlockTableRecord)Tx.GetObject(lay.BlockTableRecordId, OpenMode.ForRead), lay.LayoutName);
}
// image definitions in the dictionary (even if not currently placed)
Log("");
Log("--- image definitions ---");
try {
var nod = (DBDictionary)Tx.GetObject(Db.NamedObjectsDictionaryId, OpenMode.ForRead);
if (nod.Contains("ACAD_IMAGE_DICT")) {
var idict = (DBDictionary)Tx.GetObject(nod.GetAt("ACAD_IMAGE_DICT"), OpenMode.ForRead);
foreach (DBDictionaryEntry de in idict) {
var def = (RasterImageDef)Tx.GetObject(de.Value, OpenMode.ForRead);
Log(string.Format(" \"{0}\" -> {1} (loaded={2})", de.Key, def.SourceFileName, def.IsLoaded));
}
} else Log(" none");
} catch (System.Exception e) { Log(" " + e.Message); }
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R4.dwg [20955] DBText space=11X17 layer=BLOCK_CLOSURE (0.65,3.39) "VICINITY MAP (NOT TO SCALE)" [215E9] RasterImage space=11X17 layer=BLOCK_CLOSURE (0.66,3.52)-(2.96,5.82) src="C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714-vicinity.png" [20EC7] DBText space=17X11 layer=BLOCK_CLOSURE (2.68,8.03) "VICINITY MAP (NOT TO SCALE)" [215E7] RasterImage space=17X11 layer=BLOCK_CLOSURE (2.68,8.16)-(4.98,10.46) src="C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714-vicinity.png" [1E807] DBText space=HOUSEDIM layer=SS-BOUNDARY LAND LOT (1.18,3.60) "VICINITY MAP (NOT TO SCALE)" --- image definitions --- "VICINITY_260714" -> C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714-vicinity.png (loaded=True)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.