C3D-0206 · Vicinity map on the Springdale drawing done
Same dead reference as the C-Store drawing: VICINITY_260612 points at a Windows temp file that no longer exists, so frame 2EC1F on the sheet is blank. Repoints the definition at the map stored in the job folder, fetched for the coordinate the user supplied from Google Maps. The frame keeps its position and size. Verifies every raster resolves to a real file.
C# payload
// Point the vicinity map at the CORRECT location and off the temp folder.
//
// Two problems with VICINITY_260612:
// 1. its source was C:\Users\sanja\AppData\Local\Temp\vicinity_260612.png - Windows cleared the
// temp folder, so the definition reads loaded=False and the frame is blank. A temp path is
// not a home for a drawing asset; it does not survive a reboot or travel with the file.
// 2. it was centred on the job card coordinate (33.519202,-84.163861). The user supplied the
// real centre from Google Maps: 33.5194218,-84.1664244 - about 190 ft west.
//
// The map has been re-fetched at the user's coordinate, zoom 17, into the job folder beside the
// drawing. Only the SourceFileName changes; the frame keeps its size and position on the sheet.
const string NEWPATH = @"C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity-map.png";
if (!System.IO.File.Exists(NEWPATH)) { Log("ABORT: image not found: " + NEWPATH); return; }
Log("drawing: " + Db.Filename);
Log("new source: " + NEWPATH + " (" + new System.IO.FileInfo(NEWPATH).Length + " bytes)");
var dictId = RasterImageDef.GetImageDictionary(Db);
if (dictId.IsNull) { Log("ABORT: no image dictionary"); return; }
var dict = (DBDictionary)Tx.GetObject(dictId, OpenMode.ForRead);
int fixedCount = 0;
foreach (DBDictionaryEntry de in dict) {
var def0 = Tx.GetObject(de.Value, OpenMode.ForRead) as RasterImageDef;
if (def0 == null) continue;
string src = (def0.SourceFileName ?? "").ToUpper();
if (!src.Contains("VICINITY")) continue;
Log("");
Log("definition \"" + de.Key + "\"");
Log(" was: " + def0.SourceFileName + " loaded=" + def0.IsLoaded);
var def = (RasterImageDef)Tx.GetObject(de.Value, OpenMode.ForWrite);
def.SourceFileName = NEWPATH;
try { def.Load(); } catch (System.Exception ex) { Log(" load: " + ex.Message); }
Log(" now: " + def.SourceFileName + " loaded=" + def.IsLoaded);
fixedCount++;
}
Log("");
Log("definitions repointed: " + fixedCount);
Log("");
Log("=== VERIFY: every raster source ===");
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
int ok = 0, bad = 0;
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
foreach (ObjectId id in btr) {
var ri = Tx.GetObject(id, OpenMode.ForRead) as RasterImage;
if (ri == null || ri.IsErased) continue;
string p = "(none)"; bool exists = false, loaded = false;
try {
var d2 = (RasterImageDef)Tx.GetObject(ri.ImageDefId, OpenMode.ForRead);
p = d2.SourceFileName; loaded = d2.IsLoaded; exists = System.IO.File.Exists(p);
} catch { continue; }
if (exists) ok++; else bad++;
Log(String.Format(" [{0}] in {1,-22} exists={2,-5} loaded={3,-5} {4}",
ri.Handle, btr.Name, exists, loaded, p));
}
}
Log(" rasters resolving to a real file: " + ok + " missing: " + bad + " (verified)");
Ed.Regen();
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-Springdale Sanitary Sewer Extension As-Built 60.dwg new source: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity-map.png (56862 bytes) definition "VICINITY_260612" was: C:\Users\sanja\AppData\Local\Temp\vicinity_260612.png loaded=False now: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity-map.png loaded=True definitions repointed: 1 === VERIFY: every raster source === [2EC1F] in *Paper_Space exists=True loaded=True C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity-map.png [2823E] in As Built - DEV3896 East Lake Pkwy C-Store - Water & Sewer exists=True loaded=True C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\PDF Images\As Built - DEV3896 East Lake Pkwy C-Store - Water & Sewer087bf8df.png rasters resolving to a real file: 2 missing: 0 (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.