* claim: #5248 * feat(motion): regenerate kept traces when source inputs change * feat(motion): add a parametric Chebyshev trace demo * perf(joints): reuse face measurements across motion samples Face-centred joint origins called Body::faces on every solve, bypassing the reference-mesh reuse used for rigid placements. Share face measurements with unchanged model geometry at the existing tolerance, while guarding replaced bodies and applying offsets after the cached measurements. Cover repeated named/nearest-face solves, shape edits, retained snapshots and direct replacement with deterministic work counts. The 145-point Chebyshev dimension and range updates retain identical sampled and interpolated curves. * perf(naming): skip preparation for cached face names Both face lookup paths spawned fresh workers over every body even when their name cells were ready. Prepare only cold cells, with direct handling of zero or one cold body. Preserve the existing parallel naming path and all face selection semantics. Deterministic regressions cover repeated picked and unique-name lookups, misses, partial warmup, renames, snapshots and moved copies. Release Chebyshev medians fall from 859 to 50 ms for a dimension edit and 871 to 34 ms for a sweep edit; all 145 samples and interpolated points remain identical. Full cargo xtask ci passes with RUST_TEST_THREADS=4 and the existing local Windows validation overlays.
4.1 KiB
Chebyshev linkage motion-trace demo
The command recipe builds a coloured Chebyshev lambda linkage with four revolute joints, a saved motion study and an associative trace of the red tip. One crank revolution draws a closed curve with an approximately straight section. The blue crank, fixed pivot spacing, teal rocker and amber coupler use lengths 20, 40, 50 and 50 mm; the coupler extends another 50 mm beyond the rocker pin. These are the classical lambda proportions 1:2:2.5:5 described in Won et al. (2025). The geometry is constructed directly from circle intersections.
Build and play
From the repository root, build the CLI and generate the editable design:
cargo build --release -p solidcraft-cli
target/release/solidcraft-cli run examples/chebyshev-motion-trace.json --out target/chebyshev.solidcraft
On Windows the executable has the .exe extension. Open target/chebyshev.solidcraft
in SolidCraft. Open Motion Study, choose Chebyshev cycle and play it. The
red tip follows the retained Chebyshev trajectory sketch while the blue crank
turns through 360°. Playback reuses the trace rather than sampling it again.
Change a dimension or the driving range
Open the design's parameters and change the favourite coupler_length from
2.5 * unit_length to 55 mm. The amber link lengthens, its joint locations
follow the geometry, and the existing trajectory changes shape automatically.
Changing unit_length scales the link lengths together; changing trace_sweep
from 360 deg to 180 deg retains just the first half of the trajectory. The
saved study remains a full crank revolution so it can also show the untraced half.
For a repeatable CLI comparison, save this as target/change-chebyshev.json:
[
{
"command": "parameters.change",
"params": {"name": "coupler_length", "expression": "55 mm"}
}
]
target/release/solidcraft-cli run target/change-chebyshev.json --in target/chebyshev.solidcraft --out target/chebyshev-length55.solidcraft --timings
Use trace_sweep and 180 deg in that command to demonstrate the driving-range
edit instead. Both edits update the same sketch and wire. Undo/Redo restores the
corresponding geometry and trace together. The engine test executes the recipe,
compares all 145 trace points with an independent circle-intersection calculation,
and checks resizing, uniform scaling, the half-turn range and playback reuse.
Export a demonstration
Save the following as target/animate-chebyshev.json and run it on the generated
design. This uses SolidCraft's renderer and motion driver to export a looping GIF:
[
{
"command": "motion.export_animation",
"params": {
"study": "Chebyshev cycle",
"path": "target/chebyshev-cycle.gif",
"samples": 49,
"fps": 16,
"width": 900,
"height": 650,
"grid": false,
"axes": false,
"camera": {
"target": [25, 40, 5],
"yaw": 0,
"pitch": 1.25,
"distance": 215,
"fov": 0
}
}
}
]
target/release/solidcraft-cli run target/animate-chebyshev.json --in target/chebyshev.solidcraft
For comparable still images, use the same camera before and after the edit:
target/release/solidcraft-cli snapshot --in target/chebyshev.solidcraft --out target/chebyshev-before.png --width 900 --height 650 --camera '{"target":[25,40,5],"yaw":0,"pitch":1.25,"distance":215,"fov":0}' --no-grid --no-axes
target/release/solidcraft-cli snapshot --in target/chebyshev-length55.solidcraft --out target/chebyshev-after.png --width 900 --height 650 --camera '{"target":[25,40,5],"yaw":0,"pitch":1.25,"distance":215,"fov":0}' --no-grid --no-axes
--timings reports command execution separately from process startup and file
loading. A dimension edit includes rebuilding the affected solids and trace;
motion.trace.edit with a changed sample count measures trace regeneration on
existing geometry. Repeating the same trace definition measures the unchanged
case. Keep the build profile, sample count and hardware with any reported times.