欢迎访问中国科学院大学学报,今天是

中国科学院大学学报 ›› 2026, Vol. 43 ›› Issue (5): 603-613.DOI: 10.7523/j.ucas.2025.006

• 数学与物理学 • 上一篇    下一篇

基于CSG的二维CAD形状智能解析方法

冯卓航, 申立勇()   

  1. 中国科学院大学数学科学学院,北京 100049
  • 收稿日期:2024-12-09 修回日期:2025-03-03 发布日期:2026-09-17
  • 通讯作者: 申立勇
  • 基金资助:
    国家自然科学基金(12371384);中央高校基本科研业务费专项资助

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

Zhuohang FENG, Liyong SHEN()   

  1. School of Mathematical Sciences,University of Chinese Academy of Sciences,Beijing 100049,China
  • Received:2024-12-09 Revised:2025-03-03 Published:2026-09-17
  • Contact: Liyong SHEN

摘要:

构造实体几何 CSG 技术通过几何基元集与基元间的布尔运算来定义复杂形状,但从已有的几何形状逆向建模恢复 CSG 构造序列一直是富有挑战性的研究问题。提出一种基于Transformer的深度网络架构,解析输入的几何形状,并输出该形状的 CSG 建模序列。采取CSGNet算法作为基线,首先扩充训练所用的合成数据集,使得模型能够学习并解析更广泛的形状。此外,采取VGG编码器-Transformer解码器的自回归学习架构,基于注意力机制更好地关联生成序列,将二维形状输入解析为固定格式的CSG序列输出,得到更好的重建质量。还引入预测有效性矫正模块,确保模型不会输出无效的重建序列。结果表明,本文提出的模型在合成数据集和真实CAD数据集上都能够取得更好的质量。

关键词: 构造实体几何(CSG), 注意力机制, 深度学习, 有效性矫正

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.

Key words: constructive solid geometry(CSG), attention mechanism, deep learning, validity correction

中图分类号: