IterCAD: Iterative Program Repair for CAD Code Generation from Orthographic Views
Organizations: Fudan University Shanghai, China
Abstract
Generating executable parametric CAD code from dimension-annotated orthographic drawings is a challenging task requiring geometric understanding, procedural reasoning, and precise numerical prediction. Existing vision-language approaches typically formulate this problem as one-shot generation, preventing the model from inspecting intermediate CAD results and correcting early mistakes, often leading to non-executable code or geometrically inconsistent outputs. In this paper, we propose IterCAD, an iterative framework that reformulates orthographic-view-to-CAD generation as a progressive program repair process. Instead of predicting the final CAD code in a single pass, IterCAD repeatedly analyzes the current CAD result, reasons about its discrepancy with the target views, and explicitly decides whether to REVISE the code or STOP the refinement process. To make iterative repair learnable, we further construct IterCAD-RS, a structured revise-or-stop supervision set containing both repairable intermediate CAD states and already-correct states, and develop a three-stage training strategy for initial generation, revision learning, and multi-turn RL optimization. By closing the loop between visual understanding, geometric verification, and code refinement, IterCAD progressively corrects structural and parametric errors. Experiments on CADExpert show that IterCAD consistently improves code executability and geometric fidelity over strong one-shot baselines.
Figures & tables
| Structural Family | Perturbation Target | Representative Operations | Typical Resulting Errors |
| Body-level | Sketch plane | Change XY / YZ / XZ workplane | Wrong global orientation or projection mismatch |
| Body-level | Base profile geometry | Modify primitive type, polygon side count, or profile scale | Incorrect outer silhouette or overall geometry |
| Body-level | Extrusion parameter | Modify extrusion height or depth | Incorrect thickness or global dimensions |
| cut | Inner profile geometry | Change inner profile type or size | Wrong cavity shape or incorrect inner dimensions |
| cut | Modifier existence | Remove the cut operation | Missing inner structure |
| hole_pattern | Hole multiplicity | Increase or decrease the number of holes | Incorrect hole count |
| Model | IoU (%) | Mean CD | Med CD | Exec. (%) |
|---|---|---|---|---|
| LLaVA-1.5 ( Liu et al., 2024 ) | 0.73 | 29.36 | 8.14 | 4.79 |
| Phi-3.5-Vision ( Abdin et al., 2024 ) | 3.44 | 27.92 | 7.75 | 8.50 |
| InternVL2.5 ( Chen et al., 2024 ) | 11.98 | 22.27 | 7.36 | 23.92 |
| Qwen2.5-VL ( Bai et al., 2025b ) | 19.21 | 20.68 | 6.64 | 31.27 |
| InternVL3 ( Zhu et al., 2025 ) | 24.59 | 21.40 | 6.62 | 29.68 |
| Gemini2.5 Pro ( Comanici et al., 2025 ) | 30.86 | 14.13 | 5.97 | 39.40 |
| S1 | S2 | S3 | MT | IoU (%) | Mean CD | Med CD | Exec. (%) |
|---|---|---|---|---|---|---|---|
| Base model: Qwen3.5-9B | |||||||
| 57.42 | 3.5819 | 0.1939 | 96.39 | ||||
| 54.46 | 3.4506 | 0.3520 | 93.65 | ||||
| 60.40 | 2.8102 | 0.1590 | 93.37 | ||||
| 64.26 | 2.6319 | 0.1448 | 94.28 | ||||
| 89.91 | 0.7492 | 0.1193 | 98.51 | ||||
Parametric CAD Modeling
Parametric CAD modeling represents 3D designs as editable, constraint-driven construction histories and develops methods to generate, reconstruct, and revise them.
See all 81 papers