C3D-0223 · 260714 Huckaby: isolate the EvaluateHatch failure done
Three probes against 20CC8: non-associative hatch, a bulges-zeroed copy to test whether the arcs are the problem, and a Polyline-type loop built from the vertex/bulge arrays instead of an ObjectId loop. Each probe erases its own hatch on failure and the scratch copy is removed.
C# payload
// Isolate WHY EvaluateHatch refuses 20CC8. Three probes, none of which alter 20CC8 permanently.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
ObjectId bid;
Db.TryGetObjectId(new Handle(Convert.ToInt64("20CC8", 16)), out bid);
var src = (Polyline)Tx.GetObject(bid, OpenMode.ForRead);
Func<Polyline,string,bool> tryHatch = (bnd, label) => {
var h = new Hatch();
h.Layer = "X-DRIV-CONC";
ms.AppendEntity(h); Tx.AddNewlyCreatedDBObject(h, true);
h.SetHatchPattern(HatchPatternType.PreDefined, "AR-CONC");
h.PatternScale = 0.61;
h.Associative = false; // <-- non-associative
var ids = new ObjectIdCollection(); ids.Add(bnd.ObjectId);
try {
h.AppendLoop(HatchLoopTypes.Outermost, ids);
h.EvaluateHatch(true);
Log(string.Format("{0}: OK area {1:F0} handle {2}", label, h.Area, h.Handle));
return true;
} catch (System.Exception e) {
Log(string.Format("{0}: FAIL {1}", label, e.Message));
try { h.Erase(); } catch { }
return false;
}
};
// PROBE 1: original boundary, non-associative
tryHatch(src, "probe1 original non-assoc");
// PROBE 2: a straight-chord COPY (bulges zeroed) - does the arc geometry break it?
var flat = (Polyline)src.Clone();
for (int i = 0; i < flat.NumberOfVertices; i++) flat.SetBulgeAt(i, 0.0);
flat.Layer = "X-DRIV-CONC";
ms.AppendEntity(flat); Tx.AddNewlyCreatedDBObject(flat, true);
Log("flat copy handle " + flat.Handle + " len " + flat.Length.ToString("F2"));
bool flatOk = tryHatch(flat, "probe2 flat copy");
// PROBE 3: hatch from the boundary's own curve set instead of the ObjectId loop
if (!flatOk) {
var h3 = new Hatch();
h3.Layer = "X-DRIV-CONC";
ms.AppendEntity(h3); Tx.AddNewlyCreatedDBObject(h3, true);
h3.SetHatchPattern(HatchPatternType.PreDefined, "AR-CONC");
h3.PatternScale = 0.61;
try {
var pts = new Point2dCollection();
var bul = new DoubleCollection();
for (int i = 0; i < src.NumberOfVertices; i++) { pts.Add(src.GetPoint2dAt(i)); bul.Add(src.GetBulgeAt(i)); }
h3.AppendLoop(HatchLoopTypes.Polyline, pts, bul);
h3.EvaluateHatch(true);
Log(string.Format("probe3 polyline-loop: OK area {0:F0} handle {1}", h3.Area, h3.Handle));
} catch (System.Exception e) {
Log("probe3 polyline-loop: FAIL " + e.Message);
try { h3.Erase(); } catch { }
}
}
// remove the scratch copy
try { flat.UpgradeOpen(); flat.Erase(); Log("flat copy erased"); } catch (System.Exception e) { Log("copy erase: " + e.Message); }
Ed.Regen();
Result
Log
probe1 original non-assoc: FAIL eNotApplicable flat copy handle 20D60 len 485.42 probe2 flat copy: FAIL eNotApplicable probe3 polyline-loop: FAIL eNotApplicable flat copy erased
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.