CADTrans: A Code Tree-Guided CAD Generative
Transformer Model with Regularized Discrete Codebooks


Xufei Guo, Xiao Dong, Juan Cao, Zhonggui Chen,
CVM 2025

Code

Abstract


We propose a novel CAD model generation network called CADTrans which is based on a code tree-guided transformer framework to autoregressively generate CAD construction sequences. Firstly, three regularized discrete codebooks are extracted through vector quantized adversarial learning, with each codebook respectively representing the features of Loop, Profile, and Solid. Secondly, these codebooks are used to normalize a CAD construction sequence into a structured code tree representation which is then used to train a standard transformer network to reconstruct the code tree. Finally, the code tree is used as global information to guide the sketch-and-extrude method to recover the corresponding geometric information, thereby reconstructing the complete CAD model. Extensive experiments demonstrate that CADTrans achieves state-of-the-art performance, generating higher-quality, more varied, and complex models. Meanwhile, it provides more possibilities for CAD applications through its flexible control method, which improves design efficiency and promotes creativity.

CAD Construction Sequence Representation


The reconstructed sequence of the model is decomposed into three different primitives: entities (S), contours (P), and loops (L), and then the network is trained to extract three codebooks (right). Each codebook training network contains an encoder (E), a decoder (G), a discriminator (D), and a codebook (C). The reconstructed sequence model is represented as a tree structure where each node is encoded with a specific code in the codebook. The code tree is constructed in a top-down manner S-P-L (left).

Random Generation Result


Randomly generated 3D model

Randomly generated 3D model.

Randomly generated 2D sketch

Randomly generated 2D sketch.

Autocompletion.


The autocompletion function can further design and refine details based on the initial model of one or more parts input by the user, thereby generating a 3D model with more complex geometry and details. The code tree is supplemented according to the user's input and used as conditional information to input into our code tree-guided transformer network together with the existing CAD geometry sequence to generate a new CAD model.

Mixed Code Tree Code Generation.


Mixing codes from different code trees can generate entirely new 3D models. Locking down some of the code tree information helps to mimic a particular design style, thus generating similar design models and widening the design boundary. Code generation results for fixed loop and profile codes (left), fixed solid codes (middle), and mixed code tree (right).

Bibtex


@inproceedings{guo2025cadtransn, title = {CADTrans: A Code Tree-Guided CAD Generative Transformer Model with Regularized Discrete Codebooks}, author = {Guo, Xufei and Dong, xiao and Cao, Juan and Chen, Zhonggui}, booktitle = {Computational Visual Media Conference}, year={2025} }

Acknowledgement


This work was supported by the National Key R&D Program of China (No. 2022YFB3303400), National Natural Science Foundation of China (Nos. 62272402, 62372389), Natural Science Foundation of Fujian Province (Nos. 2024J01513243, 2022J01001), and Fundamental Research Funds for the Central Universities (No. 20720220037).