arXiv(opens in a new tab)cs.AISep 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2609.07434

CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verification

Yali Du, Hui Sun, San-Zhuo Xi, Ming Li

Yali Du, Hui Sun, San-Zhuo Xi, Ming Li

National Key Laboratory for Novel Software Technology, School of Artificial Intelligence,

Nanjing University, China

{duyl, sunh, lim}@lamda.nju.edu.cn

Abstract—Natural-language Computer-Aided Design (CAD) code generation aims to turn design intent into executable and editable parametric programs. Large language models (LLMs) make this goal increasingly practical, but useful systems must preserve the construction process behind the rendered geometry. Existing benchmarks and methods mostly focus on how closely the generated CAD model matches the reference geometry, often using metrics such as Intersection over Union (IoU). Such metrics can miss errors in part decomposition, construction hierarchy, Boolean operations, sketch structure, and geometric relations. This gap calls for a representation that makes design intent explicit and lets a system check generated code against that intent. We propose CIT-CAD, a framework that infers a Constraint Intent Tree (CIT) from the input description to represent the intended entities, hierarchy, operations, and relations. The tree has two roles: it guides CAD code generation and defines expected constraints for verification. The framework extracts actual constraints from the generated program, compares them with the expected constraints, and uses mismatches to localize and repair design violations. Experiments show that the framework improves CAD generation performance, with larger gains on more complex multi-entity designs. By turning design intent into an explicit and checkable object, this work is the first attempt to move text-to-CAD generation beyond rendered-geometry matching toward construction-aware synthesis, verification, and repair. The complete artifacts are released at https://anonymous.4open.science/r/CIT-CAD-2FC2.

Index Terms—CAD code generation, large language models, program verification, constraint reasoning, program repair

I. INTRODUCTION

Natural-language Computer-Aided Design (CAD) code generation studies how to produce executable CAD programs from design descriptions. Recent large language models (LLMs) have made this task increasingly feasible by generating CAD code from informal instructions [1]–[5]. Unlike a final geometric output, a CAD program is an editable construction procedure that records the modeling steps and parameters used to construct the object. These steps include 2D sketches, extrusions that turn sketches into 3D features, Boolean operations that add or cut parts, and geometric relations among parts. Parametric programming using CadQuery 1^{1} makes CAD code generation more amenable to LLMs by representing CAD models as executable construction procedures with explicit entities, parameters, and Boolean operations.

Recent work has explored CAD program generation from design descriptions and visual inputs using LLMs or vision-

Figure

Fig. 1: Motivating example for construction-aware CAD evaluation. Geometric-level similarity can hide program-level errors such as missing entities, incorrect Boolean roles, or violated relations, while CIT-CAD exposes these errors as explicit constraint violations.

language models [3]–[7]. These studies demonstrate the potential of automated CAD code generation for turning informal specifications into executable programs. Their evaluations commonly report execution success and final-geometry similarity, typically using Intersection over Union (IoU) over the occupied regions of the 3D models produced by generated and reference CAD code [1], [3], [4], [8]. These geometric measures are necessary because a generated CAD program must produce the requested geometry.

Final-geometry similarity is therefore necessary, but it is a coarse signal for CAD code generation. In realistic generation, a model may partially match the reference while violating construction constraints that determine how the model should be edited. An IoU score cannot localize whether an error comes from wrong decomposition, a missing feature, an incorrect Boolean role, or a violated relation between parts. Thus, natural-language CAD code generation should evaluate not only final geometry, but also the intended construction constraints behind it.

This motivates a construction-aware view of CAD code generation. Instead of treating generation as text-to-code followed mainly by final-geometry scoring, a system should make the intended construction process explicit. Natural-language descriptions rarely enumerate every requirement, but they often imply expected entities, operations, and relations. Once made explicit, these requirements can provide a common target

1^{1}https://github.com/cadquery/cadquery for generation, verification, and repair.

Under this view, the intended construction constraints are represented by a Constraint Intent Tree (CIT). A CIT records the expected CAD entities, their construction hierarchy, the operations that combine them, and the relations that should hold among them. It is intentionally lighter than a complete CAD program: rather than inferring every missing dimension or coordinate, it records the construction constraints that are important for program correctness. This makes the intended design explicit before code generation and comparable after code generation.

Building on the CIT, we propose CIT-CAD, a framework that uses the inferred construction intent as a common reference for natural-language CAD code generation, verification, and repair. Given a design description, CIT-CAD first infers a CIT and then generates executable CAD code conditioned on both the original description and this CIT. For verification, CIT-CAD derives expected constraints from the CIT and extracts actual constraints from the generated CAD program through deterministic program and geometry analysis. It then compares the two to localize violated constraints, which are converted into repair feedback for the LLM. A revised program is accepted only when it preserves previously satisfied constraints and reduces the remaining violations. In this way, CIT-CAD keeps generation, verification, and repair aligned around construction constraints rather than only final geometry.

We evaluate CIT-CAD on multi-entity samples derived from Text2CAD [1], comparing it with direct LLM-based CAD code generation. The evaluation combines valid-program rate, final-geometry similarity, and constraint satisfaction. CIT-CAD improves overall performance, especially on structurally complex designs, suggesting that explicit construction intent improves robustness beyond geometry matching alone.

This paper makes the following contributions:

• Constraint Intent Tree for CAD code generation. We introduce a tree structure that captures expected CAD entities, construction hierarchy, operations, and relations implied by natural-language descriptions.

  • CIT-based CAD generation and verification. We propose CIT-CAD, which infers a CIT, generates CAD code conditioned on it, and verifies generated programs against CIT-derived constraints.

• Localized constraint repair. We convert entity-level and relation-level violations into repair feedback and accept a repair only if it preserves satisfied constraints and reduces remaining violations.

  • Empirical evidence beyond geometry similarity. We evaluate CIT-CAD on multi-entity Text2CAD samples and show consistent improvements in executability and constraint satisfaction across multiple LLM backbones.

References (76)