Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implementation code for our paper "Drawing2CAD: Sequence-to-Sequence Learning for CAD Generation from Vector Drawings"

License

Notifications You must be signed in to change notification settings

lllssc/Drawing2CAD

Repository files navigation

Drawing2CAD: Sequence-to-Sequence Learning for CAD Generation from Vector Drawings

1Hangzhou Dianzi University 2Zhejiang University 3Shenzhen Research Institute of Big Data
4Guangzhou University 5University of Science and Technology of China

ACM Multimedia 2025

*These authors contributed equally to this work.

Installation

  • Python 3.9
  • Cuda 11.8+

Install python package dependencies through pip:

pip install -r requirements.txt

Dataset

Download data from here and extract them under data folder.

  • svg_raw contains the engineering drawings of each CAD model in SVG format, including four views: Front, Top, Right, and FrontTopRight. Each SVG file has been preprocessed through path simplification and deduplication, path reordering, and viewbox normalization. To obtain engineering drawings in PNG format, you can simply convert them using CairoSVG with a single line of code:

    import cairosvg

    cairosvg.svg2png(url=svg_path, write_to=png_path, output_width=224, output_height=224, background_color='white')
  • svg_vec contains vectorized representations of SVG drawing sequences. Each file stores the stacked drawing sequences for the four views (Front, Top, Right, and FrontTopRight), saved in .npy format to enable fast data loading.

  • cad_vec contains our vectorized representation for CAD sequences, saved in .h5 format to enable fast data loading.

[Update] All CAD models used in this project are sourced from DeepCAD. We have also released our pipeline and scripts here for exporting and preprocessing SVG drawings, making them available for anyone interested in converting their own CAD model data.

Training

To train the model in different input options:

python train.py --input_option {1x, 3x, 4x} --exp_name your_exp_name

Since different input options lead to different models, it is recommended to specify the experiment name using --exp_name for each run. For more configurable parameters and options, please refer to config/config.py.

Evaluation

After training the model, run the model to inference all test data:

python test.py --input_option {1x, 3x, 4x} --exp_name your_exp_name

After inference, the final results will be saved under proj/your_exp_name/test_results. To evaluate the model inference results and to export and visualize the final CAD models, please refer to the code from DeepCAD.

Acknowledgement

This repository builds upon the following awesome datasets and projects:

Cite

If you find this project useful for your research, please use the following BibTeX entry.

@article{qin2025drawing2cad,
title={Drawing2CAD: Sequence-to-Sequence Learning for CAD Generation from Vectorized Drawings},
author={Qin, Feiwei and Lu, Shichao and Hou, Junhao and Wang, Changmiao and Fang, Meie and Liu, Ligang},
journal={arXiv preprint arXiv:2508.18733},
year={2025}
}

@inproceedings{qin2025drawing2cad,
author = {Qin, Feiwei and Lu, Shichao and Hou, Junhao and Wang, Changmiao and Fang, Meie and Liu, Ligang},
title = {Drawing2CAD: Sequence-to-Sequence Learning for CAD Generation from Vector Drawings},
year = {2025},
doi = {10.1145/3746027.3755782},
booktitle = {Proceedings of the 33rd ACM International Conference on Multimedia},
pages = {10573-10582},
}

About

Implementation code for our paper "Drawing2CAD: Sequence-to-Sequence Learning for CAD Generation from Vector Drawings"

Topics

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Contributors 2

Languages