C3D-0203 · Repoint the vicinity map off the temp folder done
The VICINITY_260612 image definition pointed at a file in the Windows temp folder which no longer exists, so the map frame on the sheet is blank. Repoints it at a freshly fetched copy stored in the job folder beside the drawing, reloads it, and verifies every raster in the drawing now resolves to a file that exists.
C# payload
// Repoint the VICINITY_260612 image definition from the TEMP folder to the job folder.
//
// It was attached from C:\Users\sanja\AppData\Local\Temp\vicinity_260612.png - Windows cleared
// that folder, so the definition reads loaded=False and the frame on the sheet shows nothing.
// A temp path is not a home for a drawing asset: it does not survive a reboot and does not travel
// with the file. The one raster in this drawing that still works lives in the job folder, which
// is the pattern the vicinity-map recipe requires.
//
// The image has been re-fetched from Google Static Maps to:
// ...\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity.png
// Only the SourceFileName of that one definition changes; the frame keeps its size and position.
const string NEWPATH = @"C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity.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 ?? "";
bool isTemp = src.ToUpper().Contains(@"\TEMP\") || src.ToUpper().Contains("VICINITY_260612");
if (!isTemp) continue;
Log("");
Log("definition \"" + de.Key + "\"");
Log(" was: " + src + " 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);
// verify every raster in the drawing resolves to a file that exists
Log("");
Log("=== VERIFY: all raster sources ===");
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-C-Store Sewer As-Built 60.dwg new source: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity.png (49713 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.png loaded=True definitions repointed: 1 === VERIFY: all raster sources === [2EC1F] in *Paper_Space exists=True loaded=True C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612-vicinity.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.