mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 02:41:17 +00:00
Port from snaporca: the solver's 1024-unknown cliff, and the scale rungs
Two commits carried across (snaporca 579a9a9162, f68613cfc5). Past about 480 entities a sketch had NO constraints at all and said nothing: libslvs declares MAX_UNKNOWNS = 1024 and is handed every entity in the sketch at two params per point, so the whole system came back TOO_MANY_UNKNOWNS and try_add_constraints rolled the entire inferred batch back. From there no dimension could ever be applied. Constraints only couple entities that share a point, so the solver now falls back — only on TOO_MANY_UNKNOWNS — to solving connected components separately and committing all-or-nothing. The auto-constraint pass batches its Horizontal/Vertical constraints instead of one solve each, which is what kept the bulk path fast once solves started succeeding: a 1204-entity load went 1585 ms -> 562 ms. Plus the scale rungs (a thousand-entity plate drawn on by hand; the heaviest real drawings graded and timed), the --step 1 fix that used to select nothing while reporting a clean run, and scripts/ladder-all.sh as the one-command gate. Parity 17 identical / 8 diverging as expected. Kernel suite here: 188 cases / 2532 assertions, including "a sketch past the solver's unknown limit still solves". snaporca-yww4, snaporca-x6v7, snaporca-j6sr
This commit is contained in:
@@ -2353,8 +2353,13 @@ void DesignSketchTool::infer_auto_constraints(int base, double ang_tol_rad, doub
|
||||
}
|
||||
try_add_constraints(coincs); // co-located points: consistent by construction
|
||||
|
||||
// 2) Horizontal / Vertical on axis-aligned new line segments (added one at a time
|
||||
// so a single conflict never drops the others).
|
||||
// 2) Horizontal / Vertical on axis-aligned new line segments. Tried as ONE batch first and
|
||||
// only then one at a time, which is the same outcome — a single conflict never drops the
|
||||
// others — for one solve instead of n. That matters now that large sketches actually
|
||||
// solve: a bulk add of 1200 axis-aligned segments used to be fast only because every
|
||||
// solve failed instantly on the unknown limit, and once they started succeeding the
|
||||
// per-constraint loop turned into 1200 solves and blew the MCP main-thread budget.
|
||||
std::vector<SketchEntityConstraintDef> axes;
|
||||
for (int i = base; i < n; ++i) {
|
||||
if (m_entities[i].type != SketchEntity::Type::Line) continue;
|
||||
auto ax = infer_axis_constraint(m_entities[i].p0, m_entities[i].p1, ang_tol_rad);
|
||||
@@ -2363,8 +2368,10 @@ void DesignSketchTool::infer_auto_constraints(int base, double ang_tol_rad, doub
|
||||
c.type = *ax;
|
||||
c.ea = i; c.ra = SketchPointRole::P0;
|
||||
c.eb = i; c.rb = SketchPointRole::P1;
|
||||
try_add_constraints({ c });
|
||||
axes.push_back(c);
|
||||
}
|
||||
if (!try_add_constraints(axes))
|
||||
for (const auto& c : axes) try_add_constraints({ c });
|
||||
|
||||
resolve_live();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user