CAD-from-Code: A Programmatic Data Engine for CAD Synthesis and Deterministic Evaluation

Junchao Li, Jinghang Wang, Yuchen Zhang, Yun Wu, Wai Yuet Chiu, Jinxin Wang, Mingkai MiaoarXiv 2026

TL;DR

Generating a 3D model that looks like a mechanical gear is easy for modern AI, but generating one that actually fits onto a shaft without jamming requires exact mathematical precision. The authors introduce CAD-from-Code, a programmatic engine that automatically generates complex 3D mechanical parts, engineering blueprints, and multi-part assemblies from shared code recipes—alongside a strict, math-based grading system that evaluates AI engineering agents without relying on fuzzy "LLM-as-a-judge" guesswork.

What Problem Does This Paper Address?

Imagine asking an AI agent to design a bracket for an engine. Visually, the output might look plausible. However, in real-world engineering, "close enough" fails: bolt holes might be off by half a millimeter, walls might be paper-thin, or solid parts might secretly intersect in 3D space.

To train and test AI agents on Computer-Aided Design (CAD), we need massive datasets pairing 2D blueprints, 3D geometries, and assembly instructions. Right now, we face three bottlenecks:

  1. Human data doesn't scale: Hiring mechanical engineers to manually draw blueprints and 3D models is slow and expensive.
  2. Disconnected artifacts: Existing datasets usually just have simple 3D shapes (sketch-and-extrude), lacking the detailed 2D dimensioned drawings and multi-part assembly rules engineers actually use.
  3. Flawed grading: Many current benchmarks grade AI-generated 3D models using global shape overlap (which misses tiny, critical local defects like a blocked screw hole) or Vision-Language Models (VLMs) acting as judges (which guess based on renders rather than checking exact physical tolerances).

Methods

Instead of scraping human designs or asking an LLM to hallucinate tasks, the authors built CAD-from-Code—a procedural generation pipeline where a single executable code "recipe" and a random seed act as the single source of truth.

Figure 2. Programmatic synthesis from constrained design specifications, with validation of geometry, derived artifacts, and task packaging.

Here is what makes their approach distinct:

  • Constrained Recipes: A recipe defines building blocks (shafts, gears, holes, fillets) and engineering rules. Parameters aren't sampled blindly; they are coupled so holes don't accidentally slice a part in two, and mating parts (like a shaft and a bore) share compatible dimensions.
  • Shared-State Derivation: Executing a recipe builds an exact B-Rep (Boundary Representation—the mathematical gold standard in CAD that defines solids via exact surfaces, edges, and vertices rather than pixelated triangles). Because the code knows where every hole and chamfer was placed, it simultaneously exports the 3D model, lays out multi-sheet 2D blueprints with measurement callouts, and calculates how multi-part assemblies lock together.
  • Stage-Wise Validation & Isolation: Automated geometry kernels check every generated task—verifying solids are watertight, annotations are readable, and assemblies don't physically collide. If a check fails, it resamples locally. Finally, it splits outputs into public inputs for the AI (e.g., 2D drawings, unplaced parts) and hidden ground truth for grading.
  • Judge-Free Deterministic Scoring: No LLMs or VLMs grade the homework. Using CAD geometry kernels, the offline evaluator checks exact physical dimensions, topological structure (counting components, holes, and internal voids), local "keep-in/keep-out" clearance zones, and symmetry-aware 3D assembly poses.

Datasets

The authors used their engine to build a new 85-task synthetic CAD benchmark (cross-validated by four human CAD experts for realism and legibility), split across three tracks:

  • Drawing-to-STEP (44 tasks): Reconstructing an exact 3D CAD model (STEP file) from 2D engineering blueprints.
  • Annotation Recovery (28 tasks): Reading masked 2D blueprints alongside a 3D model to recover missing numerical dimensions and symbols.
  • Assembly Reconstruction (13 tasks): Taking loose 3D parts and an assembly drawing to output a fully positioned, non-colliding multi-part 3D assembly (averaging 262.3 component instances per assembly!).
Figure 1. Some example parts and assembly from CAD-from-Code.

Unlike prior datasets like DeepCAD (limited to basic sketch-and-extrude single parts) or Text2CAD-Bench and AssemCAD (which rely on VLM/LLM judges), this benchmark covers parts, drawings, and assemblies jointly with exact programmatic verification. The authors also evaluate models against 63 external expert-designed reconstruction tasks to validate their synthetic tasks against real human designs.

Key Insights and Ideas

  • Synthetic data can be harder and richer than human samples: In a matched comparison of 35 synthetic vs. 35 expert-designed parts, the programmatic parts had 39.5% more B-Rep faces, 158% more distinct supporting planes, and more curved B-spline surfaces—all generated rapidly at near-zero marginal cost.
  • Synthetic benchmarks mirror real-world difficulty: When testing six AI agents on both the 44 synthetic and 63 human-expert reconstruction tasks, model scores correlated strongly (Pearson $r = 0.870$), agreeing on 13 out of 15 pairwise model rankings. Programmatic tasks capture real engineering signal without human authoring overhead.
  • "No single model rules CAD": Different frontier models excel at completely different engineering skills—meaning spatial geometry, blueprint reading, and multi-part assembly must be evaluated separately.
  • Self-checks can backfire: Watching agent trajectories revealed that while top agents cross-check 2D views to fix mistakes, weaker models often write flawed self-verification scripts that accidentally reinforce their own bad geometric assumptions.

Key Results

Six LLM-based coding agents were given Linux environments with Python CAD libraries (build123d and OCP) and up to 3 hours per task. No model was used for training; this was a pure agentic evaluation.

Model performance across CAD tracks
  • Overall Scores (0 to 1 scale): GPT-6.1 Sol took first place overall (0.727), followed by Claude Opus 5.5 (0.689), Gemini 4 Argon (0.649), DeepSeek V4.1 Flash (0.569), GLM-5.3 Flash (0.367), and Doubao Seed 2.1 Pro (0.293).
  • Track Leaders:
  • Drawing-to-STEP: Gemini 4 Argon dominated at 0.891 (vs. GPT-6.1 Sol at 0.742) by carefully tracing multi-view projection constraints.
  • Annotation Recovery: Claude Opus 5.5 led with 0.818 by systematically organizing callouts page-by-page without omissions.
  • Assembly: GPT-6.1 Sol led with 0.688 (while Gemini dropped to 0.295, occasionally getting stuck in local analysis without finishing the final files).

Limitations and Future Work

Because generation relies on predefined programmatic recipes, the diversity of parts is bounded by the engineering families currently coded into the engine. Furthermore, the current assembly tasks focus on static structural configurations rather than moving machinery. Looking ahead, the authors plan to expand their library of engineering recipe families and extend the engine to cover CAD model editing (modifying existing parts) and articulated mechanisms with dynamic motion.

Summary updated

BibTeX
@misc{li2026cad,
  author = {Junchao Li and Jinghang Wang and Yuchen Zhang and Yun Wu and Wai Yuet Chiu and Jinxin Wang and Mingkai Miao},
  title = {{CAD-from-Code: A Programmatic Data Engine for CAD Synthesis and Deterministic Evaluation}},
  year = {2026},
  eprint = {2611.37262},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.37262},
}
Figure