C3D-0374 · READ-ONLY: why do manholes + control point vanish when HIDDEN freezes? [C3D-MHDIAG] done
Examines the SEWER_MANHOLE, SEWER_MANHOLE_EXISTING and HORIZONTAL_AND_VERTICAL_CONTROL_POINT layers - are they block inserts, and what layers is each block's INTERNAL geometry drawn on? Then finds block definitions whose inner entities were moved onto HIDDEN (so freezing HIDDEN blanks the symbol even though the insert's own layer is on). This is the likely cause; MH 384 survives because its symbol uses explicit layers, not 0.
C# payload
// Diagnose why sewer manholes and the control point vanish when HIDDEN is frozen.
// Theory: these are BLOCK REFERENCES on their proper layer, but their internal geometry was
// drawn on layer "0" - so moving 0-content to HIDDEN and freezing HIDDEN hides the block guts.
Log("drawing: " + Db.Filename);
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
System.Action<string> examine = (layerName) => {
Log("");
Log("=== entities on layer " + layerName + " ===");
foreach (ObjectId id in ms) {
var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null) continue;
if (!e.Layer.Equals(layerName, StringComparison.OrdinalIgnoreCase)) continue;
var br = e as BlockReference;
if (br == null) { Log(string.Format(" [{0}] {1}", e.Handle, e.GetType().Name)); continue; }
var def = (BlockTableRecord)Tx.GetObject(br.BlockTableRecord, OpenMode.ForRead);
// count the block's internal geometry by layer
var byLayer = new Dictionary<string,int>();
foreach (ObjectId sid in def) {
var se = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (se == null) continue;
string sl = se.Layer; // "0" here means "inherit the insert's layer"
if (!byLayer.ContainsKey(sl)) byLayer[sl]=0;
byLayer[sl]++;
}
var parts = new System.Text.StringBuilder();
foreach (var kv in byLayer) { if (parts.Length>0) parts.Append(", "); parts.Append(kv.Key).Append(":").Append(kv.Value); }
Log(string.Format(" [{0}] INSERT \"{1}\" at ({2:F1},{3:F1}) inner-layers[{4}]",
br.Handle, def.Name, br.Position.X, br.Position.Y, parts.ToString()));
}
};
examine("SEWER_MANHOLE");
examine("SEWER_MANHOLE_EXISTING");
examine("HORIZONTAL_AND_VERTICAL_CONTROL_POINT");
// how many things now on HIDDEN are actually block sub-entities used by a live insert?
Log("");
Log("=== HIDDEN layer: block definitions that draw internal geometry on HIDDEN ===");
int defsUsingHidden = 0;
foreach (ObjectId bid in bt) {
var def = (BlockTableRecord)Tx.GetObject(bid, OpenMode.ForRead);
if (def.IsLayout) continue;
int cnt = 0;
foreach (ObjectId sid in def) {
var se = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (se != null && se.Layer.Equals("HIDDEN", StringComparison.OrdinalIgnoreCase)) cnt++;
}
if (cnt > 0) {
int refs = def.GetBlockReferenceIds(true,false).Count;
Log(string.Format(" block \"{0}\": {1} inner entities on HIDDEN, {2} live inserts", def.Name, cnt, refs));
defsUsingHidden++;
}
}
if (defsUsingHidden==0) Log(" (none - problem is elsewhere)");
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\ACAD-260612-Springdale Sanitary Sewer Extension As-Built 60 wPROFILE.dwg === entities on layer SEWER_MANHOLE === [1979] INSERT "*U31" at (2296827.2,1280096.0) inner-layers[V-NODE-STRM:1] [197F] INSERT "*U32" at (2296878.7,1280034.2) inner-layers[V-NODE-STRM:1] [1984] INSERT "*U33" at (2296980.5,1279912.3) inner-layers[V-NODE-STRM:1] [1989] INSERT "*U34" at (2297249.9,1279675.2) inner-layers[V-NODE-STRM:1] [198E] INSERT "*U35" at (2297269.0,1279597.7) inner-layers[V-NODE-STRM:1] [1993] INSERT "*U36" at (2297423.0,1279618.8) inner-layers[V-NODE-STRM:1] === entities on layer SEWER_MANHOLE_EXISTING === [1998] INSERT "*U37" at (2297424.7,1279599.3) inner-layers[V-NODE-STRM:1] === entities on layer HORIZONTAL_AND_VERTICAL_CONTROL_POINT === [1BDE] INSERT "*U95" at (2297261.5,1279689.3) inner-layers[V-NODE-BORE:1, V-NODE-TEXT:2] === HIDDEN layer: block definitions that draw internal geometry on HIDDEN === block "Drainage MH": 2 inner entities on HIDDEN, 1 live inserts block "*X1": 15 inner entities on HIDDEN, 1 live inserts block "Drill Hole": 3 inner entities on HIDDEN, 1 live inserts block "STA": 2 inner entities on HIDDEN, 1 live inserts block "Sewer Manhole": 2 inner entities on HIDDEN, 14 live inserts block "Existing Hyd": 10 inner entities on HIDDEN, 5 live inserts block "Water Valve": 5 inner entities on HIDDEN, 9 live inserts block "Tree 6": 144 inner entities on HIDDEN, 2 live inserts block "Catch Basin": 4 inner entities on HIDDEN, 1 live inserts block "Iron Pin": 2 inner entities on HIDDEN, 8 live inserts block "Utility Pole": 5 inner entities on HIDDEN, 2 live inserts block "_Wipeout_Circle": 1 inner entities on HIDDEN, 25 live inserts block "*U21": 2 inner entities on HIDDEN, 1 live inserts block "*U24": 2 inner entities on HIDDEN, 1 live inserts block "*U39": 2 inner entities on HIDDEN, 1 live inserts block "*U44": 2 inner entities on HIDDEN, 1 live inserts block "*U48": 2 inner entities on HIDDEN, 1 live inserts block "*U49": 2 inner entities on HIDDEN, 1 live inserts block "*U50": 2 inner entities on HIDDEN, 1 live inserts block "*U51": 2 inner entities on HIDDEN, 1 live inserts block "*U52": 2 inner entities on HIDDEN, 1 live inserts block "*U53": 2 inner entities on HIDDEN, 1 live inserts block "*U54": 2 inner entities on HIDDEN, 1 live inserts block "*U55": 2 inner entities on HIDDEN, 1 live inserts block "*U58": 2 inner entities on HIDDEN, 1 live inserts block "*U63": 2 inner entities on HIDDEN, 1 live inserts block "*U64": 2 inner entities on HIDDEN, 1 live inserts block "*U65": 2 inner entities on HIDDEN, 1 live inserts block "*U66": 2 inner entities on HIDDEN, 1 live inserts block "*U67": 2 inner entities on HIDDEN, 1 live inserts block "*U68": 2 inner entities on HIDDEN, 1 live inserts block "*U73": 2 inner entities on HIDDEN, 1 live inserts block "*U79": 2 inner entities on HIDDEN, 1 live inserts block "*U83": 2 inner entities on HIDDEN, 1 live inserts block "*U84": 2 inner entities on HIDDEN, 1 live inserts block "*U86": 2 inner entities on HIDDEN, 1 live inserts block "*U87": 2 inner entities on HIDDEN, 1 live inserts block "*U88": 2 inner entities on HIDDEN, 1 live inserts block "*U89": 2 inner entities on HIDDEN, 1 live inserts block "AecObjExplode_22X17_Vport_1D7E": 5 inner entities on HIDDEN, 0 live inserts
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.