Skip to content
Projets

À propos

Official code repository of "CADFit: Precise Mesh-to-CAD Program Generation with Hybrid Optimization" @ ICML 2026

Sciences et ingénierie

Comment ces chiffres sont mesurés

What you can do

  • Rich operator set. Extrude, Revolve, Fillet, Chamfer, Union, Cut — far beyond sketch-and-extrude pipelines.
  • IoU-driven optimization, kernel-validated. Every candidate is built through CadQuery; the optimizer maximizes the same volumetric IoU it reports. Invalid Ratio = 0 on every benchmark slice.
  • Compact construction sequences. Backward marginal pruning produces shorter, cleaner programs than the originals, giving higher-quality supervision for downstream learning models.
  • Iterative residual refinement. Positive and negative residuals are reconstructed with the same pipeline and composed with Union / Cut, until residual volume falls below tolerance.

Progression mesurée des étoiles

in 24h
0
in 7 days
+1
in 15 days
+5
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

CADFit: Precise Mesh-to-CAD Program Generation with Hybrid Optimization

Ghadi Nehme1, Eamon Whalen2, Faez Ahmed1
1Massachusetts Institute of Technology
2Siemens Digital Industries Software

arXiv Project Page HuggingFace YouTube CADStudio


Introduction

CADFit is a hybrid optimization-based framework that recovers complex, editable CAD construction sequences from watertight meshes by incrementally fitting and validating parametric operations using geometric feedback. Rather than predicting programs in a single forward pass, CADFit formulates reconstruction as an explicit IoU-driven optimization over executable CAD programs, supporting a rich operator set (extrusions, revolutions, fillets, chamfers) composed using Boolean union and cut.


Key Features

  • Rich operator set. Extrude, Revolve, Fillet, Chamfer, Union, Cut — far beyond sketch-and-extrude pipelines.
  • IoU-driven optimization, kernel-validated. Every candidate is built through CadQuery; the optimizer maximizes the same volumetric IoU it reports. Invalid Ratio = 0 on every benchmark slice.
  • Compact construction sequences. Backward marginal pruning produces shorter, cleaner programs than the originals, giving higher-quality supervision for downstream learning models.
  • Iterative residual refinement. Positive and negative residuals are reconstructed with the same pipeline and composed with Union / Cut, until residual volume falls below tolerance.
  • Modality-agnostic. The same algorithm handles meshes from STL exports, point clouds, or images-to-3D models (we use Hunyuan3D) — no retraining.

Qualitative Mesh-to-CAD Results

DeepCAD, Fusion360, and ABC (easy/medium/hard). CADFit produces a valid, editable CAD program on every input where baselines either output Invalid or visibly diverge from the target geometry.


Multimodal Image-to-CAD

CADFit is agnostic to where the mesh comes from. Pairing it with a pretrained image-to-3D model — we use Hunyuan3D — and standard post-processing (watertight enforcement, Taubin smoothing, mesh decimation) gives a fully end-to-end image-to-CAD pipeline.


Example CadQuery Output

Every CADFit run emits an executable Python script that reproduces the solid in CadQuery:


Quick Start

conda create -n cadfit-env python=3.10 && conda activate cadfit-env
pip install -r requirements.txt

Reconstruct every STL in a folder:

python run_pipeline.py <input_folder>

Outputs land in <input>_runs/<stl_id>/ (override with --output-folder OUT):

<input>_runs/<stl_id>/
├── best_greedy_parallel_iterative.stl   # final reconstruction
├── best_greedy_parallel_iterative.py    # equivalent CadQuery program
└── final_iou.json                       # { final_iou, duration, ... }

Common flags:

flag effect
--max-iterations N residual cut/union refinement passes (default 1)
--skip-existing resume — skip STLs whose final_iou.json exists
--fillet-chamfer enable per-edge fillet/chamfer pass (off by default)
--limit N, --start-from FILE.stl narrow the input list

For best throughput on a multi-core box, raise the inner worker pool:

CADFIT_INNER_WORKERS=25 python run_pipeline.py abc_hard

Call from Python directly:

from run_pipeline import process_single_stl
process_single_stl("abc_hard/00013080.stl",
                    folder_name="abc_hard_runs",
                    max_iterations=1)

Citation

If you find our work helpful, please consider citing:

@article{nehme2026cadfit,
  title={CADFit: Precise Mesh-to-CAD Program Generation with Hybrid Optimization},
  author={Nehme, Ghadi and Whalen, Eamon and Ahmed, Faez},
  journal={arXiv preprint arXiv:2605.01171},
  year={2026}
}

License

Released under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license — free for academic and research use; see LICENSE for full terms.

A provisional patent application has been filed covering the CADFit method. Commercial licensing inquiries: [email protected].


Contact

For questions, issues, or collaboration, please contact: [email protected]


Explorer des projets similaires

Chargement…