Skill: linkage-synthesis · Paper: LinkD: Autoregressive diffusion for mechanical linkage synthesis, Barati Farimani Lab, arXiv:2601.04054
LinkD designs one-degree-of-freedom planar linkages whose end-effector traces a target curve.
How it represents a mechanism:
How each proposal is checked:
Success rates in the paper:
| Retry strategy | Success rate |
|---|---|
| One-shot | 29.4% |
| Graph-level retry | 96.7% |
| Node-level retry | 99.6% |
The paper does not release the trained weights. The skill therefore keeps the representation, the validation, the node-by-node construction with bounded retries, and the Chamfer metric exactly as published. In place of the diffusion sampler, an optimizer proposes nodes: differential evolution, then Nelder–Mead. It also adds practicality limits (link ratio, pivot spacing, overall size), so a fit cannot come from a mechanism nobody could build.
npx skills add BaratiLab/mechanical-engineering-skills --skill linkage-synthesis
pip install numpy scipy matplotlib
cd skills/linkage-synthesis
Simulate the example four-bar, then ask the synthesizer to find a mechanism for that curve without being told the answer:
python scripts/linkage.py validate examples/fourbar.json
python scripts/linkage.py simulate examples/fourbar.json --out fourbar_curve.csv
python scripts/synth.py fourbar_curve.csv --out recovered.json --max-nodes 5
The second four-bar attempt reached CD = 0.0002, meaning the recovered mechanism traces the same curve. Run this check whenever you change the code.
python scripts/synth.py --preset bean --out bean.json --max-nodes 7
python scripts/linkage.py plot bean.json --target bean_target.csv --out bean.png
The log shows the paper’s construction loop at work:
[four-bar] attempt 2: CD = 0.0526
[grow] 7 nodes: CD = 0.0497
[grow] no proposal improved the fit after 25 retries; stopping at 7 nodes

Result:
The fit is good everywhere except the convex lobe on the right. That lobe is what the next dyad would have had to fix, and none of the 25 proposals improved it by more than 2%.
compare --raw gives
the paper’s protocol when both curves come from mechanisms.--invariant searches 72 rotations and a reflection. Use it only if the
mechanism may be installed rotated or mirrored.bean.json, scaled to your size, and check link
thickness and clearances in CAD (see parametric-part-cad).machine-element-sizing.linkage.py validate reports the minimum joint separation over the cycle. Keep it larger
than the pin diameter.Cite: LinkD, arXiv:2601.04054.