Repository navigation
3D sketch: hold 3D points to model edges, planes, faces and the sketch's 2D curves (#10616) - #11481
Closed
Karl-VonRichter wants to merge 20 commits into
Closed
Karl-VonRichter wants to merge 20 commits into
Karl-VonRichter wants to merge 20 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cy-labs#10613) The fit points of curves drawn in a 3D sketch take constraints of their own, stored in `Sketch.wire_constraints` and solved in a pass after the planar sketch, so planar sketches solve exactly as before and a 3D constraint never moves planar geometry. - Coincident (two 3D points, or a 3D point on a drawn 3D line), Fix and the new Along Axis (`sketch.constraint.along_axis`, with input and output schemas). 3D refs: `<curve>.start|end|through|<n>` or a 3D point's id. - 3D Line joins the segments it draws with a Coincident at each joint. - Move 3D Point solves the 3D constraints with the moved point held, and is refused when they cannot hold it there or the point is fixed. - A conflicting 3D constraint is refused; deleting a curve takes its 3D constraints with it; the sketch's degrees of freedom count the 3D points. - Fixed points are constants, as in the planar solve; each connected group is solved by damped least squares with central-difference derivatives. - One pending format file; designs without 3D constraints are unchanged. Part of tangency-labs#10608. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…atives (tangency-labs#10613) Review fixes for step 1 of tangency-labs#10608: - The 3D solve has its own report (SolveReport::wires); planar edits measure the planar sketch's freedoms and conflicts again, and a failing 3D group no longer fails the planar sketch or blocks planar edits. - Coincident points are one unknown, fixed points constants; each constraint's Jacobian is exact (forward-mode dual numbers), so freedoms count right far from the origin. - Groups are capped at 1,500 unknowns and 3,000 residual rows, a solve has a work budget and gives up when it stalls, and drags skip the rank pass. - Every drawn 3D curve joins the drawn ends it meets; curves drawn before 3D constraints are joined when the sketch is first constrained. - A design whose 3D constraint names a missing fit point opens (it is dropped); a motion trace's rebuilt curve drops its constraints; foreign pastes map Fix points and axes; sketch.delete takes a curve with its own constraint; created and sketch.inspect list 3D constraints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…angency-labs#10613) Second review round on step 1 of tangency-labs#10608: - `solved` in a reply is the planar sketch's again (`wires_solved` beside it); a strict edit is refused for breaking the planar sketch only when it changed it, and for breaking the 3D constraints only when it changed them. - A failing group no longer freezes the others; a solve that runs out of work says the sketch is too large to solve in time instead of listing conflicts. - The work budget counts the multiply-adds actually done (linalg::solve_counted, rank_counted), the freedom count included; damping is scaled per unknown and a step moves no point more than a quarter of its group's size. - A 3D line or arc squeezed to a point, or points thrown far, are refused as for planar curves. - A motion trace's curve takes no 3D constraints and is not joined to; only a sketch's first 3D constraint joins existing ends, so a deleted joint stays gone. - A paste's axis must map exactly onto an axis; saved 3D constraint ids may not be another entity's; move3d names a point fixed through a joint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…abs#10613) Marquardt's per-unknown damping made a step favour some directions, so a solve no longer moved points as little as it could (a lengthened line did not grow along itself). The damping is the same for every unknown again, scaled by the largest curvature so a group solves alike at any size, and a step moves no point more than a twentieth of its group's size (more when a length or a dragged point has further to go), so turning a line keeps its length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…angency-labs#10613) Third review round on step 1 of tangency-labs#10608: - Freedoms are counted once every group is solved, so the count cannot use up the work a later group needs; a solve already within tolerance when the work runs out is kept; the row reduction works on row slices. - A curve that cannot be rebuilt fails its own group, which stays where it was; the other groups are placed again without it. - A strict edit is refused for the 3D constraints it breaks that held before it or that it adds, not for one failing elsewhere; a sketch too large to solve refuses only an edit that makes it so; running out of time says so. - sketch.move3d refuses a move that squeezes a 3D curve away; a non-strict edit that would keeps the curves as the edit left them. - A sketch stores that its curves were joined once (`wires_joined`): an older unjoined path is joined with the first curve drawn or constraint added, a deleted joint stays deleted, and copied 3D curves are joined where they meet. - A motion trace's curve adds no freedoms to the count; its refusal is tested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gency-labs#10613) Under the repository's testing rules, unit tests assert logic and geometry is graded by the kernel-cases rig. The engine tests now check where the 3D solve puts the points only; the pipe built along a line held parallel to X by Along Axis is the sweeps case 10613-pipe-along-a-3d-line-held-along-x, its volume, centre and box worked out by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`sketch.dimension` takes 3D refs: a drawn 3D line's length, the distance between two 3D points or along X, Y or Z only (keeping the side it was measured on), the angle between two drawn 3D lines, and a drawn 3D arc's radius. Each is driven by a model parameter (a value, an expression or `name = expression`) or is driven (reference); a dimension the other 3D constraints already settle is refused. Dimensions measure the sketch as the current parameters solve it. `sketch.line3d`, `.spline3d`, `.arc3d` and `.point3d` take expressions in point coordinates: the point is held where they come to (a Fix that follows them), in a sketch whose component is not moved. The model parameters of 3D dimensions and the expressions of 3D points are in use like their planar counterparts (not pruned, renamed, copied with the sketch, carried into extracted and cloned components), through `Sketch::dimension_params` and the sketch's expression lists. One pending format file. Part of tangency-labs#10608. Review fixes: angles are smooth at their common values (0/180 hold lines parallel; a parallel start is nudged off), an angle between lines that meet is the corner's; driven dimensions need only be finite; a parameter change stores the solved 3D curves and is refused when it breaks the 3D constraints; script export, foreign paste of point expressions, if_redundant and toggle_driven handle 3D dimensions. Second review round: driven dimensions are checked as driven on every solve (any finite value), errors name the constraint; a stalled start is nudged when no step improves, only the constraints still off and by their own size; a parameter value a 3D dimension cannot take is refused; 3D dimensions are listed under created dimensions and inspect gives their expression and degrees; a foreign paste maps distances along an axis; a model entity beside a 3D ref is refused, not dropped; the script export test replays the script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly behind (tangency-labs#10614) A point a solve left a hair behind (rounding) no longer flips the side the dimension keeps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le (tangency-labs#10614) An angle's residual in radians had next to no pull beside a length in mm once the lines were metres long, so a solve with both stalled (5 m and 20 m lines failed). It is now an arc length: the angle times the lines' size, taken as a constant of the step so shrinking a line gains nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cy-labs#10614) Third review round on step 2 of tangency-labs#10608: - A new angle dimension's parameter is written at full precision: rounded to six places it was off by more than an angle between long lines holds to, so a settled angle was refused as a conflict instead of placed driven. - A parameter change is refused when this sketch's own 3D values cannot take it, not for any error (an upstream one is not the edit's to refuse). - A stalled start is not nudged while a dragged point is pulled; the stall window starts again after a nudge; the nudge is the size of the constraint's own lines, not of the span between them. - A value edit that squeezes a 3D curve away is refused; a new 3D dimension's bad value is said of the value; a count the work ran out on is not read as redundancy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…angency-labs#10614) Session::world_state now returns a Result; the test helper that reads a solved 3D curve unwraps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ions (tangency-labs#10615) Between drawn 3D curves: Parallel, Perpendicular and Collinear for two lines, Equal for two lines (length) or two arcs (radius), and Tangent for a line and an arc that meet at an end (the line along the arc's direction there, its end held on the arc's end). The existing sketch.constraint.parallel, .perpendicular, .collinear, .equal and .tangent take 3D refs. To the origin planes of the sketch's 3D space: Parallel takes a line and `xy`, `yz` or `xz`; the new sketch.constraint.on_plane holds 3D points on one (with input and output schemas); sketch.dimension takes a 3D point and a plane (signed distance, keeping its side) or a 3D line and a plane (angle, 0-90°). Construction planes and model faces come with step 4 (tangency-labs#10616). One pending format file. Part of tangency-labs#10608. Review fixes: Equal between arcs is an explicit `arcs` field (no prefix in wire ids); Tangent holds the line leaving the arc the way it runs on (no cusp); the angle to a plane is signed and smooth at 0 and holds the line square at 90; a parallel start is nudged off for Perpendicular; On Plane takes plane names in either case; the planar relation commands' help names their 3D refs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ngency-labs#10615) Second review round on step 3 of tangency-labs#10608: - Parallel, Perpendicular, Collinear, Tangent and the angle to a plane compare directions as units weighed by the lines' size (a constant of the step), so they solve beside lengths at building scale (near-parallel Perpendicular at 5 m failed); with step 2's nudge on a stalled start, Equal arcs from a semicircle and a Tangent's fold-back solve too. - A paste from another design maps the plane relations: onto the plane the paste turns them to, a shift along the normal making a point on the plane that far from it; one turned onto no origin plane goes. - Making a driven angle to a plane driving keeps the side the line rises to; a side is only "behind" when clearly so, not by rounding. - On Plane's label has its own pending file; strict mode takes plane names in any case and axis names X/Y/Z; the dimension help names the plane forms; Parallel's plane error says what it takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ncy-labs#10615) Third review round on step 3 of tangency-labs#10608: - A paste from another design that shifts a distance from a plane along its normal rewrites the dimension's parameter to the shifted distance, so a solve keeps the point where the paste put it (it pulled it back); a turn only flips its side and keeps the value; an On Plane turned into a distance gets a parameter of its own. - Collinear's and Tangent's direction rows no longer widen the solver's step, so a line they turn keeps about its length. - Plane and axis names publish an any-case pattern, as strict mode takes them; their errors no longer repeat the key. - Making an already driving angle to a plane driving keeps its side; the reply types plane_distance and plane_angle are taken as input; Equal's `curves` with 3D curves says to give a pair; step 1's text file is left as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…el rig (tangency-labs#10615) Under the repository's testing rules, unit tests assert logic and geometry is graded by the kernel-cases rig. The tangent test now checks where the 3D solve puts the line and that a loose line is refused; the pipe along a line held on the XY plane by On Plane is the sweeps case 10615-pipe-along-a-3d-line-held-on-the-xy-plane, its volume, centre and box worked out by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h's 2D curves (tangency-labs#10616) A drawn 3D point or line can now be held to fixed geometry, which the 3D solve never moves: - a model curve brought in with sketch.include_3d: its start or end (Coincident), its line (Point On Line, Parallel, Perpendicular, Collinear) or, for a circular edge, its circle (the new point_on_curve), read from the edge's exact curve, following the model by its edge name; - a 2D point, line, circle or arc of the same sketch, placed through the sketch's plane; - a plane of the model for On Plane, Parallel and distance and angle dimensions: a construction plane by name, or {face: [x,y,z], body?}, the planar body face through that point. The face is picked exactly from the B-rep's planes and SMLib's point classification (a point where two face planes meet is refused), kept by its face name, and resolved again whenever the links are. Distances may run from an included model point or a 2D point. A constraint that holds nothing the 3D sketch can move is refused. Pasting into another design drops constraints held to the source design's planes and faces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Karl-VonRichter
force-pushed
the
feat/sketch-3d-dimensions-4
branch
from
November 4, 2026 03:43
e515a0e to
bacaf6e
Compare
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
Collaborator
|
Thanks for this! I'm closing older PRs that have gone quiet or drifted from main, since a lot has changed in the last couple of weeks. If you'd still like this in, please open a fresh PR against current main; happy to review it. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a 3D sketch, the points and lines drawn off the sketch plane can now be held to the model and to the sketch's own 2D geometry. A 3D point can sit on a model edge's end, on its line or on a circular edge's circle, on a 2D point, line, circle or arc of the same sketch, or on a construction plane or a planar face of a body. It stays there when the model or the 2D sketch changes. Distances and angles can be dimensioned from those faces and planes too.
This is the fourth of five pull requests for #10608 (dimensions and constraints in 3D sketches). Fixes #10616.
Builds on #10652, which builds on #10636 and #10609. Until they merge, this diff includes their commits. This pull request's own change is the commit after its
claim: #10616commit.Changes a default: no
Evidence
A 3D sketch line on a 150 SHS beam (
len= 3000), with a Ø40 pipe along it. Both ends are held on the beam's top face, the line is parallel to XZ, its start is dimensionedlen / 2from the near end face and its end 370 from the far end face. Thenshs→ 120 andlen→ 3500 (solidcraft-cli snapshot, the same camera):shs= 150,len= 3000shs= 120,len= 3500The runner goes down with the tube top and stretches to stay half the length from the start and 370 from the far end. This is the case #10608 was opened for, now from a script.
What changed
sketch.include_3dis fixed geometry for the 3D constraints. A drawn 3D point can sit on its start or end (sketch.constraint.coincident), on its line (straight edges: Coincident, and Parallel, Perpendicular and Collinear with a drawn line), or on its circle (circular edges: the newpoint_on_curvekind). The line and circle come from the edge's exact curve. The included edge follows the model by its edge name, as included edges already do.sketch.constraint.on_plane,sketch.constraint.parallel(a line and a plane) andsketch.dimension(a point's distance from a plane, a line's angle to it) take, besidesxy,yzandxz:{face: [x,y,z], body?}, the planar body face through that point.cargo xtask mesh-decisions: no new mesh decisions.sketch.dimensiontakes two points where one is an included model point or a 2D point.sketch-3d-attachment.rs. A plane is still saved as"xy","yz"or"xz", or as an object naming the plane or face. Older designs have none of these.Not in this step:
Tests
Expected values are worked out by hand.
crates/sketch/src/wire_solve_tests.rs(+4):crates/engine/src/cmd/sketch_3d_frame_tests.rs(+6):shsandlenchanges.Run here (Windows,
ciprofile), onmainat 185c480:-D warningson sketch, doc, engine and ui-egui;solidcraft-sketchall 376;solidcraft-docwith SMLib (its 3 failures also fail on a cleanmaincheckout here);sketch,param,clipboard,component,hostile,inspect,schema,motionorscript(one failure,intersection_curve_of_picked_faces_spans_the_whole_surface, also fails on a cleanmaincheckout here);cargo xtask lists,layers,skills,i18n --check,mesh-decisions;scripts/test-format-pending.sh;cargo xtask ci: mesh-decisions reports no new mesh decisions. Of its 50 test failures, 37 also fail on a cleanmaincheckout here; 12 pass when run alone (timing on this machine under the full run); the last, the kernel proptestscale_invariant, fails the same way on a cleanmaincheckout with the same seed.🤖 Generated with Claude Code