Premium apps Part of Kerfwise

Parametric Sketch Constraint Solver

Solve a 2-D constraint sketch with parameters, report degrees of freedom and extrude it.

Points {id, x, y} in mm; entities line {a, b}, arc {c, a, b} counter-clockwise, circle {c, r}; constraints {id, type, refs, value}.

More options

Each expression may use the parameters above it, for example D = W / 2.

Try an example: Panel with a tangent fillet arc (radius R) · Rectangle whose depth is half its width (D = W / 2) · Over-constrained: a second, contradicting width · L-shaped bracket profile with equal leg thickness

More about this tool

How it works

Solve points, lines, arcs and circles under geometric and dimensional constraints driven by named parameters. Get exact coordinates, the remaining degrees of freedom, redundant and conflicting constraints, and the profile extruded as a Kerfwise Form Studio solid.

  • Variables are the coordinates of every point that is not fixed and the radius of every circle; an arc adds the equation |start − centre| = |end − centre|. Each constraint adds one or two residual equations in millimetres (angles are scaled by the sketch size), so the solution is r(x) = 0.
  • Levenberg–Marquardt with identity damping: each step solves min ‖J·δ + r‖² + μ‖δ‖² by Householder QR (Proofline’s linear algebra). With small μ this is the minimum-norm Gauss–Newton step, so geometry that the constraints leave free moves as little as possible from the stored sketch.
  • Degrees of freedom = variables − rank of the Jacobian at the solution. The rank comes from Gram–Schmidt over the normalised constraint rows in order: a row that is a combination of earlier rows is redundant if its residual is zero, or conflicting (with the rows it depends on) if it is not.
  • Dimensions are numbers or expressions in the parameter table, compiled by Proofline’s safe expression parser (no eval). Lengths are millimetres, angles degrees, tangency at a shared end point is written as radius ⊥ line.
  • The profile is the single closed loop of non-construction lines and arcs (or one circle), arcs tessellated with chords of at most 15°, at most 64 points. It becomes a Form Studio extrusion with the evaluated height.

Concept geometry. A sketch can have several solutions (for example an arc bulging inward or outward); the solver finds the one nearest to the stored points. Check the drawing.

Sources

Part of Kerfwise

  • Kerfwise Cabinet & furniture CAD

    Design cabinets and furniture, get cut lists, optimised sheet layouts, costs and drawings.

    Open Kerfwise

Related tools

How to use the Parametric Sketch Constraint Solver

Solve a 2-D sketch of lines, arcs and circles under constraints and named parameters, read its degrees of freedom and extrude it into a solid.

What it is for

A parametric sketch describes a shape by rules instead of fixed coordinates: this edge is horizontal, that arc is tangent to both edges, the width is W and the depth is W / 2. Change W and the whole outline follows. The solver takes such a sketch as JSON, finds coordinates that satisfy every constraint and tells you whether the sketch is fully defined, still has freedom left, or contains rules that repeat or contradict each other.

When the sketch forms one closed loop of lines and arcs (or one circle), the outline becomes an extruded solid for Kerfwise Form Studio, with STL, OBJ and an editable project. Form Studio's New parametric sketch editor runs the same solver, so a sketch built here opens there unchanged.

It solves 2-D profiles only: one closed outline per solid, no holes.

Worked example

The first example is a 600 × 400 mm panel with one rounded corner. The parameters are W = 600, D = 400, R = 100 and T = 19. The arc round runs from p3 on the right edge to p4 on the top edge, with two tangent constraints and a radius of R.

The result: The sketch is fully constrained: every point is defined. There are 10 variables, 10 equations, Jacobian rank 10 and 0 degrees of freedom. The arc centre lands at (500, 300), p3 at (600, 300) and p4 at (500, 400), exactly R from both edges. The profile has 10 points, because the quarter arc is drawn with six 15° chords, and it extrudes 19 mm.

Change the parameters to W = 800, D = 450 and R = 60, and the centre moves to (740, 390) with p4 at (740, 450).

Now delete the width constraint from the rectangle example. The tool reports 1 degree of freedom remains. p2 and p3 are marked free at x = 490 mm, between their stored positions of 500 and 480. The solver moved them only as far as the remaining rules required.

How to read the result

  • Degrees of freedom = variables − Jacobian rank. Zero means fully constrained; three usually means no point is fixed and no line oriented.
  • Status: fully constrained, under-constrained, over-constrained (a redundant rule, still solved) or conflicting (rules that cannot hold together, named in the message).
  • Solved points: coordinates in mm and a state: fixed, defined or free. The drawing shows fixed points as squares and free points as open orange circles.
  • Constraints: each rule with its evaluated value, state and residual.
  • Profile and project: the footprint and a Form Studio project that stores the sketch and the parameter table, so later changes re-solve it.

Tips and common mistakes

  • Fix one point and make one line horizontal first. That removes the three rigid-body freedoms.
  • Use distanceX and distanceY for signed dimensions. distance only fixes a length, so the shape can flip.
  • Parameters are evaluated top to bottom: D = W / 2 must come after W.
  • Arcs run counter-clockwise from start to end. If an arc bulges the wrong way, swap its start and end.
  • Mark helper lines as construction so they stay out of the outline.
  • A conflict names every rule involved. Remove or change one of them; adding more rules never helps.

FAQ

Why does the solver keep my points where they were?

Each step makes the smallest change that reduces the errors (a minimum-norm Gauss–Newton step), so whatever the rules leave open stays close to the stored sketch.

What is the difference between redundant and conflicting?

A redundant rule repeats something already defined, such as a second identical width, and the sketch still solves. A conflicting rule asks for something else, like a width of W + 10. The tool keeps a least-squares compromise and gives no solid.

Can I use angles and expressions in dimensions?

Yes. Values may be numbers or expressions such as W / 2 or 2 * R + 10. Angle constraints take degrees.

Does the extrusion fuse with other solids?

No. Like every Form Studio solid it is a separate closed prism.

Guide last updated:

For scripts and AI agents

  • JSON API: POST https://kerfwisesketchconstraintsolver.usefulweb.site/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://kerfwisesketchconstraintsolver.usefulweb.site/mcp · tool name kerfwise_sketch_constraint_solver
Example request
curl -s -X POST https://kerfwisesketchconstraintsolver.usefulweb.site/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{…see OpenAPI examples…}'
Feedback · ideas & bug reports welcome