agentleFS
gugu-2gugu-2/Prompt-CAD/skills/scan-to-code/SKILL.md

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.

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
  1. Very specific:

    Extract Primitives: Run scripts/extract_primitives.py on the raw .stl or .obj scan.

    line 12
  2. Very specific:

    Compare Geometry: Run scripts/compare_mesh.py comparing the raw scan and your generated STEP file.

    line 14

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Extract Primitives: Run scripts/extract_primitives.py on the raw .stl or .obj scan. This tool attempts to fit basic shapes (bounding boxes, cylinders) and provides their exact center points and dimensions.
  2. Draft CAD Code: Using the extracted dimensions, write the first pass of the build123d python script.
  3. Compare Geometry: Run scripts/compare_mesh.py comparing the raw scan and your generated STEP file. It computes the Hausdorff distance (max error) and volumetric overlap.
  4. Iterate: The comparison script will output hints on where the errors lie. Update the build123d code, 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.step

References

  • references/scan-to-code-guidelines.md - How to interpret primitive extraction and geometric comparison errors to accurately refine CAD parameters.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.