Welcome to Journal of University of Chinese Academy of Sciences,Today is
Mathematics & Physics

An intelligent analysis method for 2D CAD shapes based on CSG

  • Zhuohang FENG ,
  • Liyong SHEN
Expand
  • School of Mathematical Sciences,University of Chinese Academy of Sciences,Beijing 100049,China

Received date: 2024-12-09

  Revised date: 2025-03-03

  Online published: 2025-03-26

Abstract

Constructive solid geometry (CSG) is a geometric modeling technique that defines complex shapes through Boolean operations between basic geometric primitives. However, reverse modeling to recover the CSG construction sequence from existing geometric shapes has been a challenging research problem. In this paper, we propose a Transformer-based deep network architecture that can parse input geometric shapes and output their corresponding CSG modeling sequences. Using the CSGNet algorithm as a baseline, we first expanded the synthetic dataset used for training, enabling the model to learn and parse a broader range of shapes. Additionally, we adopted an autoregressive learning architecture with a VGG encoder and a Transformer decoder, leveraging the attention mechanism to better correlate the generated sequences. This approach translates 2D shape inputs into CSG sequence outputs in a fixed format, resulting in improved reconstruction quality. We also introduced a validity correction module to ensure that the model does not output invalid reconstruction sequences. Experimental results show that the proposed model achieves better quality on both synthetic and real CAD datasets.

Cite this article

Zhuohang FENG , Liyong SHEN . An intelligent analysis method for 2D CAD shapes based on CSG[J]. Journal of University of Chinese Academy of Sciences, 2026 , 43(5) : 603 -613 . DOI: 10.7523/j.ucas.2025.006

References

[1] Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need[C]//Proceedings of the 31st International Conference on Neural Information Processing Systems. December 4 - 9, 2017, Long Beach, California, USA. New York: ACM, 2017: 6000-6010. DOI: 10.5555 /3295222.3295349 .
[2] Sharma G, Goyal R, Liu D F, et al. CSGNet: neural shape parser for constructive solid geometry[C]//2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. June 18-23, 2018, Salt Lake City, UT, USA. IEEE, 2018: 5515-5523. DOI:10.1109/CVPR.2018.00578 .
[3] Simonyan K, Zisserman A. Very deep convolutional networks for large-scale image recognition[EB/OL]. arXiv 2014: 1409.1556. (2014-09-04)[2024-12-06]. .
[4] Fischler M A, Elschlager R A. The representation and matching of pictorial structures[J]. IEEE Transactions on Computers1973, C-22(1): 67-92. DOI:10.1109/T-C.1973.223602 .
[5] Felzenszwalb P F, Huttenlocher D P. Pictorial structures for object recognition[J]. International Journal of Computer Vision200561(1): 55-79. DOI:10.1023/B:VISI.0000042934.15159.49 .
[6] Yang Y, Ramanan D. Articulated pose estimation with flexible mixtures-of-parts[C]//CVPR 2011. June 20-25, 2011, Colorado Springs, CO, USA. IEEE, 2011: 1385-1392. DOI:10.1109/CVPR.2011.5995741 .
[7] Weiss D. Geometry-based structural optimization on CAD specification trees[D/OL]. Zurich: ETH Zurich2009[2024-12-06]. .
[8] Foley J, Shapiro V, Vossler D L. Separation for boundary to CSG conversion[J]. ACM Transactions on Graphics199312(1): 35-55. DOI: 10.1145/169728.169723 .
[9] Buchele S F, Crawford R H. Three-dimensional halfspace constructive solid geometry tree construction from implicit boundary representations[C]//Proceedings of the Eighth ACM Symposium on Solid Modeling and Applications. June 16 - 20, 2003, Seattle, Washington, USA. ACM, 2003: 135-144. DOI:10.1145/781606.781629 .
[10] Balog M, Gaunt A, Brockschmidt M, et al. DeepCoder: learning to write programs[EB/OL]. arXiv 2016: 1611.01989. (2016-11-07)[2024-12-06]. .
[11] Johnson J, Hariharan B, Van Der Maaten L, et al. Inferring and executing programs for visual reasoning[C]//2017 IEEE International Conference on Computer Vision (ICCV). October 22-29, 2017, Venice, Italy. IEEE, 2017: 3008-3017. DOI:10.1109/ICCV.2017.325 .
[12] Zhou C H, Li C L, Póczos B. Unsupervised program synthesis for images by sampling without replacement[EB/OL]. arXiv 2020: 2001.10119. (2020-01-21)[2024-12-06]. .
[13] Jones R K, Walke H, Ritchie D. PLAD: learning to infer shape programs with pseudo-labels and approximate distributions[C]//2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 18-24, 2022, New Orleans, LA, USA. IEEE, 2022: 9861-9870. DOI:10.1109/CVPR52688.2022.00964 .
[14] Li L X, Sung M, Dubrovina A, et al. Supervised fitting of geometric primitives to 3D point clouds[C]//2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 15-20, 2019, Long Beach, CA, USA. IEEE, 2019: 2647-2655. DOI:10.1109/CVPR.2019.00276 .
[15] Lambourne J G, Willis K D D, Jayaraman P K, et al. BRepNet: a topological message passing system for solid models[C]//2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 20-25, 2021, Nashville, TN, USA. IEEE, 2021: 12768-12777. DOI:10.1109/CVPR46437.2021.01258 .
[16] Kania K, Zi?ba M, Kajdanowicz T. UCSG-net: unsupervised discovering of constructive solid geometry tree[EB/OL]. arXiv 2020: 2006.09102. (2020-06-16)[2024-12-06]. .
[17] Ren D X, Zheng J M, Cai J F, et al. CSG-stump: a learning friendly CSG-like representation for interpretable shape parsing[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). October 10-17, 2021, Montreal, QC, Canada. IEEE, 2021: 12458-12467. DOI:10.1109/ICCV48922.2021.01225 .
[18] Chen Z Q, Tagliasacchi A, Zhang H. BSP-net: generating compact meshes via binary space partitioning[C]//2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 13-19, 2020. Seattle, WA, USA. IEEE, 2020: 42-51. DOI:10.1109/cvpr42600.2020.00012 .
[19] Yu F G, Chen Z Q, Li M Y, et al. CAPRI-net: learning compact CAD shapes with adaptive primitive assembly[C]//2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 18-24, 2022, New Orleans, LA, USA. IEEE, 2022: 11758-11768. DOI:10.1109/CVPR52688.2022.01147 .
[20] Yu F G, Chen Z Q, Tanveer M, et al. D2 CSG: unsupervised learning of compact CSG trees with dual complements and dropouts[EB/OL]. arXiv 2023: 2301.11497. (2023-01-27)[2024-12-06]. .
[21] Wu R D, Xiao C, Zheng C X. DeepCAD: a deep generative network for computer-aided design models[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). October 10-17, 2021, Montreal, QC, Canada. IEEE, 2021: 6752-6762. DOI:10.1109/ICCV48922.2021.00670 .
[22] Xu X, Willis K D D, Lambourne J G, et al. SkexGen: autoregressive generation of CAD construction sequences with disentangled codebooks[EB/OL]. arXiv 2022: 2207.04632. (2022-07-11)[2024-12-06]. .
[23] Khan M S, Dupont E, Ali S A, et al. CAD-SIGNet: CAD language inference from point clouds using layer-wise sketch instance guided attention[C]//2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 16-22, 2024, Seattle, WA, USA. IEEE, 2024: 4713-4722. DOI:10.1109/CVPR52733.2024.00451 .
[24] Yang B C, Jiang H Y, Pan H, et al. PS-CAD: local geometry guidance via prompting and selection for CAD reconstruction[EB/OL]. arXiv 2024: 2405.15188. (2024-05-24)[2024-12-06]. .
[25] 何皓辰,方正,卢政达,等. PT-MFR:一种基于Point Transformer的CAD模型加工特征识别方法[J].中国科学院大学学报202643(1):115-124. DOI:10.7523/j.ucas.2024.041 .
[26] 黄玉林,梁磊,李卫军,等.基于多尺度特征和注意力机制的深度学习点云压缩[J].中国科学院大学学报202441(5): 687-694. DOI:10.7523/j.ucas.2023.077 .
Outlines

/