C3D-0218 · 260714 Huckaby: probe existing hatch patterns done
READ-ONLY. Lists the pattern name, type, scale and layer of every Hatch already in the drawing, to find one that is proven to work here before retrying the driveway concrete hatch.
C# payload
// READ-ONLY probe: what hatch patterns do existing hatches in this drawing use?
// 260714 has 25+ Hatch entities already (snapshot), so the drawing proves what works.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var seen = new Dictionary<string,int>();
foreach (ObjectId btrId in bt) {
var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
foreach (ObjectId id in btr) {
Autodesk.AutoCAD.DatabaseServices.DBObject o;
try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
var h = o as Hatch;
if (h == null) continue;
string key;
try {
key = string.Format("{0} | type={1} scale={2:F3} layer={3}",
h.PatternName, h.PatternType, h.PatternScale, h.Layer);
} catch { continue; }
if (!seen.ContainsKey(key)) seen[key] = 0;
seen[key]++;
}
}
Log("=== EXISTING HATCH PATTERNS ===");
foreach (var kv in seen) Log(string.Format("{0} x{1}", kv.Key, kv.Value));
Log("distinct: " + seen.Count);
Result
Log
=== EXISTING HATCH PATTERNS === AR-CONC | type=PreDefined scale=0.610 layer=X-DRIV-CONC x1 SOLID | type=PreDefined scale=1.000 layer=0 x22 ANSI31 | type=PreDefined scale=1.000 layer=0 x2 ANSI31 | type=PreDefined scale=5.000 layer=LS-EX. TREE x2 ANSI31 | type=PreDefined scale=2.000 layer=LS-BOULDER x3 AR-CONC | type=PreDefined scale=1.000 layer=0 x1 distinct: 6
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.