scan-to-code
Skill2 starsChanged 6 months agoMITView on GitHub
Reverse engineer raw 3D scans (STL/OBJ) by iteratively writing parametric build123d code and comparing it against the scan using Hausdorff distance.
In this repository26 other files it gives its agents.
- harness/AGENTS.mdAGENTS.md
- harness/CLAUDE.mdCLAUDE.md
- auto-kinematicsSkill
- real-time-bom-costingSkill
- cadSkill
- camSkill
- competitor-benchmarkSkill
- regulatory-compliance-checkerSkill
- semantic-design-intent-memorySkill
- drawing-generatorSkill
- enterprise-vaultSkill
- esg-analyzerSkill
- exploded-viewSkill
- fastener-standard-enforcerSkill
- feaSkill
- multi-physics-cosimulationSkill
- patent-detectorSkill
- predictive-maintenanceSkill
- renderSkill
- sdfSkill
- sendcutsendSkill
- sketch-to-cadSkill
- srdfSkill
- step-partsSkill
- tolerance-stackup-analyzerSkill
- urdfSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Extract Primitives: Run scripts/extract_primitives.py on the raw .stl or .obj scan.
- Very specific: line 14
Compare Geometry: Run scripts/compare_mesh.py comparing the raw scan and your generated STEP file.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Parametric Reverse Engineering (Scan-to-Code)
Purpose
Convert "dumb" unstructured meshes (3D scans) into clean, editable, parametric CAD files. Use geometric analysis to extract features and mathematically compare the generated code's output to the original scan until the error is minimal.
Required workflow
- Extract Primitives: Run
scripts/extract_primitives.pyon the raw.stlor.objscan. This tool attempts to fit basic shapes (bounding boxes, cylinders) and provides their exact center points and dimensions. - Draft CAD Code: Using the extracted dimensions, write the first pass of the
build123dpython script. - Compare Geometry: Run
scripts/compare_mesh.pycomparing the raw scan and your generated STEP file. It computes the Hausdorff distance (max error) and volumetric overlap. - Iterate: The comparison script will output hints on where the errors lie. Update the
build123dcode, regenerate the STEP, and re-run the comparison until the Mean Distance is under 0.5mm.
Available tools
python scripts/extract_primitives.py --scan broken_part.stl
python scripts/compare_mesh.py --scan broken_part.stl --generated generated_part.stepReferences
references/scan-to-code-guidelines.md- How to interpret primitive extraction and geometric comparison errors to accurately refine CAD parameters.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

