C3D-0202 · READ-ONLY: images, OLE frames and underlays done
Reports every OLE frame, raster image and PDF/DWF underlay with its layer, placement and source path, plus whether each source file still exists on this machine, to distinguish linked (fragile) images from ones that travel with the drawing. No changes.
C# payload
// READ-ONLY. What images are in this drawing and are they LINKED (fragile) or embedded?
// The snapshot showed 3 Ole2Frame on layer 0; OLE frames are links that break when the source
// moves or the file is sent elsewhere. Rasters attached by path are also links unless the path
// travels with the drawing. Report every image-bearing object with its source and placement.
// Nothing is modified.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);
Log("");
Log("=== OLE FRAMES (linked/embedded objects) ===");
int nole = 0;
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
foreach (ObjectId id in btr) {
var ol = Tx.GetObject(id, OpenMode.ForRead) as Ole2Frame;
if (ol == null) continue;
nole++;
var e = ol.GeometricExtents;
Log(String.Format(" [{0}] in {1} layer={2}", ol.Handle, btr.Name, ol.Layer));
Log(String.Format(" extents {0:F3},{1:F3} -> {2:F3},{3:F3} ({4:F2} x {5:F2})",
e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y,
e.MaxPoint.X - e.MinPoint.X, e.MaxPoint.Y - e.MinPoint.Y));
}
}
Log(" OLE frames: " + nole);
Log("");
Log("=== RASTER IMAGES ===");
int nras = 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) continue;
nras++;
var e = ri.GeometricExtents;
Log(String.Format(" [{0}] in {1} layer={2} show={3}", ri.Handle, btr.Name, ri.Layer, ri.ShowImage));
Log(String.Format(" extents {0:F3},{1:F3} -> {2:F3},{3:F3} ({4:F2} x {5:F2})",
e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y,
e.MaxPoint.X - e.MinPoint.X, e.MaxPoint.Y - e.MinPoint.Y));
try {
var def = (RasterImageDef)Tx.GetObject(ri.ImageDefId, OpenMode.ForRead);
Log(" source: " + def.SourceFileName);
Log(" loaded: " + def.IsLoaded);
} catch (System.Exception ex) { Log(" def: " + ex.Message); }
}
}
Log(" raster images: " + nras);
Log("");
Log("=== IMAGE DEFINITIONS IN THE DICTIONARY ===");
try {
var dictId = RasterImageDef.GetImageDictionary(Db);
if (dictId.IsNull) Log(" (no image dictionary)");
else {
var dict = (DBDictionary)Tx.GetObject(dictId, OpenMode.ForRead);
foreach (DBDictionaryEntry de in dict) {
var def = Tx.GetObject(de.Value, OpenMode.ForRead) as RasterImageDef;
if (def == null) continue;
Log(" \"" + de.Key + "\" loaded=" + def.IsLoaded);
Log(" " + def.SourceFileName);
Log(" file exists on this machine: " + System.IO.File.Exists(def.SourceFileName));
}
}
} catch (System.Exception ex) { Log(" dictionary: " + ex.Message); }
Log("");
Log("=== PDF / DWF / DGN UNDERLAYS ===");
int nund = 0;
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
foreach (ObjectId id in btr) {
var u = Tx.GetObject(id, OpenMode.ForRead) as UnderlayReference;
if (u == null) continue;
nund++;
Log(" [" + u.Handle + "] " + u.GetType().Name + " in " + btr.Name + " layer=" + u.Layer);
try {
var ud = (UnderlayDefinition)Tx.GetObject(u.DefinitionId, OpenMode.ForRead);
Log(" source: " + ud.SourceFileName + " item=" + ud.ItemName);
Log(" file exists: " + System.IO.File.Exists(ud.SourceFileName));
} catch (System.Exception ex) { Log(" def: " + ex.Message); }
}
}
Log(" underlays: " + nund);
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
=== OLE FRAMES (linked/embedded objects) ===
[2F9F6] in *Model_Space layer=SS-0-FRAME
extents 2296209.246,1279309.035 -> 2297858.073,1280399.852 (1648.83 x 1090.82)
[10C9C] in A$C2CD672AE layer=0
extents 0.000,0.000 -> 3018.629,728.833 (3018.63 x 728.83)
[10CA5] in A$C2CD672AE layer=www.cadblocksfree.com
extents 0.000,0.000 -> 25.930,9.468 (25.93 x 9.47)
[10CA6] in A$C2CD672AE layer=www.cadblocksfree.com
extents 11160.735,2.972 -> 13154.759,731.053 (1994.02 x 728.08)
[1FEBB] in 11x17 COVER SHEET SS layer=0
extents 27.955,11.034 -> 35.097,17.733 (7.14 x 6.70)
[1FEBC] in 11x17 COVER SHEET SS layer=0
extents 1.887,11.785 -> 9.385,17.582 (7.50 x 5.80)
OLE frames: 6
=== RASTER IMAGES ===
[2EC1F] in *Paper_Space layer=BLOCK_CLOSURE show=True
extents 10.744,-4.236 -> 14.705,-0.275 (3.96 x 3.96)
source: C:\Users\sanja\AppData\Local\Temp\vicinity_260612.png
loaded: False
[1DAC] in _Wipeout_Circle layer=0 show=True
extents -0.499,-0.496 -> 0.499,0.500 (1.00 x 1.00)
def: eNullObjectId
[1240A] in _TagCircle layer=0 show=True
extents -0.125,-0.125 -> 0.125,0.125 (0.25 x 0.25)
def: eNullObjectId
[2823E] in As Built - DEV3896 East Lake Pkwy C-Store - Water & Sewer layer=PDF2_GENERAL-TEXT show=True
extents 1.387,3.328 -> 7.182,5.731 (5.79 x 2.40)
source: 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
loaded: True
raster images: 4
=== IMAGE DEFINITIONS IN THE DICTIONARY ===
"As Built - DEV3896 East Lake Pkwy C-Store - Water & Sewer087bf8df" 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
file exists on this machine: True
"VICINITY_260612" loaded=False
C:\Users\sanja\AppData\Local\Temp\vicinity_260612.png
file exists on this machine: False
=== PDF / DWF / DGN UNDERLAYS ===
underlays: 0Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.