Source-linked AI summary

DeepCAD: A Deep Generative Network for Computer-Aided Design Models

Rundi Wu, Chang Xiao, Changxi Zheng

arXiv:2105.09492v2cs.CVcs.GRcs.LG

TL;DR

Most 3D generative models produce discrete representations rather than the CAD drawing process. DeepCAD models CAD operation sequences with a Transformer autoencoder, and the authors report plausible, diverse generated designs.

  • Problem

    Existing 3D generative models produce discrete shape representations, leaving generation of the shape-design process itself missing.

    Source: §1 · p. 1
  • Method

    DeepCAD uses a Transformer autoencoder to encode CAD operation sequences into a latent space and decode them back into sequences.

    Source: §1 · p. 2, §3.2 · p. 4
  • Results

    The authors report that DeepCAD generates plausible and diverse CAD designs.

    Source: §1 · p. 2
  • Takeaways & Limitations

    Generated designs can be easily user edited.

    Source: §4.2 · p. 8

    DeepCAD cannot guarantee topological soundness, and failures become more likely as command sequences grow longer.

    Source: §5 · p. 8

Abstract

from arXiv · show

Deep generative models of 3D shapes have received a great deal of research interest. Yet, almost all of them generate discrete shape representations, such as voxels, point clouds, and polygon meshes. We present the first 3D generative model for a drastically different shape representation --- describing a shape as a sequence of computer-aided design (CAD) operations. Unlike meshes and point clouds, CAD models encode the user creation process of 3D shapes, widely used in numerous industrial and engineering design tasks. However, the sequential and irregular structure of CAD operations poses significant challenges for existing 3D generative models. Drawing an analogy between CAD operations and natural language, we propose a CAD generative network based on the Transformer. We demonstrate the performance of our model for both shape autoencoding and random shape generation. To train our network, we create a new CAD dataset consisting of 178,238 models and their CAD construction sequences. We have made this dataset publicly available to promote future research on this topic.

1. Introduction

DeepCAD addresses the gap between generating discrete 3D representations and generating the CAD drawing process itself. It represents CAD designs as command sequences and uses a Transformer autoencoder, trained on a newly created public dataset, to generate CAD models.

Introduction

  • The paper presents, to its authors’ knowledge, the first generative model that outputs CAD operations as a sequence representing the 3D shape creation process.Existing 3D generative models instead create point clouds [6] [52] [53] [8] [30], polygon meshes [42] [31], or levelset fields [12] [33] [29] [50] [11].Source: §1 · p. 1
  • CAD sequences combine ordered geometric operations with discrete and continuous parameters, making existing models for discrete 3D representations unsuitable.The method unifies frequently used commands, their types, parameters, and order, then uses a Transformer autoencoder to embed CAD models in a latent space and decode vectors into command sequences.Source: §1 · pp. 1–2
  • The authors create and publicly release a CAD command-sequence dataset described as orders of magnitude larger than existing datasets of the same type.The dataset is introduced to support training the autoencoder and promote future research on learning-based CAD design.Source: §1 · p. 2
  • The method generates plausible and diverse CAD designs, and the paper evaluates generation quality through ablation studies.The introduction also points to useful applications enabled by the CAD autoencoder.Source: §1 · p. 2

2. Related work

The paper positions CAD-sequence generation among parametric shape inference and 3D generative modeling, distinguishing its Transformer-based CAD-operation output from discrete shape generators and prior operation-based systems.

Generative models of 3D shapes

  • Most existing 3D generators produce voxel, point-cloud, mesh, or implicit-SDF shapes [49, 16, 27, 26, 6, 52, 53, 8, 30, 17, 42, 31, 12, 33, 29, 50, 11], which can be noisy, lack sharp features, and are not directly editable.Source: §2 · p. 2

Parametric shape inference

  • Prior systems infer parametric patches, curves, or boundaries from geometric inputs, while Li et al. [25] map sketches to CAD operations and Xu et al. [51] search for sequences from parametric solids.Source: §2 · p. 2

Operation-based shape generation

  • CSGNet [37] infers CSG sequences from voxel inputs, UCSG-Net [21] removes ground-truth CSG-tree supervision, and DSL methods [39] [41] [30] [20] include ShapeAssembly [20], whose hierarchical, symmetrical cuboid proxies can be generated by a variational autoencoder.Source: §2 · p. 2

Transformer-based models

  • The autoencoder directly generates editable CAD-operation sequences, which can be imported into CAD tools or converted to point clouds and meshes; the authors call it the first generative model producing CAD designs.CAD models are described as a standard representation across industrial production sectors.Source: §2 · p. 2
  • Transformers have been used for natural language processing [13] [40], image and other data [14] [31] [10] [44], and concurrent constrained CAD-sketch generation [47] [32] [15].Source: §2 · p. 2
  • Unlike DeepSVG [10]’s unordered 2D primitives, CAD commands are 3D, interdependent, and order-sensitive, motivating a new Transformer encoding for CAD commands and their sequence.Source: §2 · p. 2

3. Method

DeepCAD models CAD construction sequences rather than B-reps, using a network-oriented command representation and Transformer autoencoder trained on a large command-sequence dataset.

3.1. CAD Representation for Neural Networks

  • Command sequences preserve human-interpretable, editable construction steps that are difficult to recover from a B-rep, which abstracts away how a shape was created.A command sequence can be converted into a B-rep, but different sequences may produce the same B-rep.Source: §3.1 · p. 3

3.1.1 Specification of CAD Commands

  • The representation uses sketch commands for closed profiles and extrusion commands to create bodies and specify how they combine with existing geometry.Sketch loops use line, arc, or circle commands, which account for 92% of curve-command cases in the dataset.Source: §3.1.1 · pp. 3–4, Table 1 · p. 3

3.1.2 Network-friendly Representation

  • To make variable CAD commands network-ready, DeepCAD uses 16-parameter vectors, pads sequences to 60 commands, and quantizes normalized continuous parameters into 256 levels.Quantization turns parameter prediction into classification, helping preserve geometric relations such as parallel or perpendicular sketch lines.Source: §3.1.2 · p. 4

3.2. Autoencoder for CAD Models

  • A Transformer autoencoder embeds each command in 256 dimensions, encodes the sequence into a 256-dimensional latent vector, and decodes it into a predicted command sequence.The decoder uses learned constant embeddings and attends to the latent vector; unlike autoregressive language models, it predicts the sequence with a feed-forward strategy.Source: §3.2 · pp. 4–5

3.3. Creation of CAD Dataset

  • The authors release 178,238 CAD designs as command sequences, split randomly into 90% training, 5% validation, and 5% test sets.The dataset addresses the lack of construction sequences in ABC and the roughly 8,000-design scale of the Fusion 360 Gallery dataset.Source: §3.3 · p. 5

3.4. Training and Runtime Generation

  • The autoencoder is trained with cross-entropy loss, and random CAD generation samples Gaussian vectors for a latent GAN whose output is decoded into a command sequence.The GAN uses four-hidden-layer MLP generator and discriminator networks and Wasserstein training with gradient penalty.Source: §3.4 · pp. 5–6

4. Experiments

Experiments evaluate CAD autoencoding and latent-space shape generation, then discuss point-cloud reconstruction and user editing as potential applications.

4.1. Autoencoding of CAD Models

  • Figure 4 compares autoencoding results, renders hidden edges in white, shows ground truth in the bottom row, and highlights the best results in a dashed-line box.Source: Figure 4 · p. 6
  • Autoencoding evaluation covers command and parameter accuracy, Chamfer Distance from 2,000 sampled surface points, and the ratio of outputs that cannot form point clouds.Parameter accuracy applies only to correctly recovered commands; parameter values are quantized to 8-bit integers with tolerance η = 3 of 256 levels.Source: §4.1 · pp. 6–7
  • Ours+Aug achieves the best autoencoding performance, while Alt-ArcMid performs similarly to Ours, supporting synthetic-data gains and middle-point arc representation.The paper suggests randomly composed training sequences improve generalization.Source: §4.1 · p. 7

4.2. Shape Generation

  • Our method achieves point-cloud metrics comparable to l-GAN, without claiming superiority between models designed for different application areas.The CAD outputs also have smoother surfaces and sharper geometric features than point clouds.Source: Table 3 · p. 7, §4.2 · p. 8

4.1. Autoencoding of CAD Models

  • Alt-Trans slightly worsens CD, while Alt-Rel’s predecessor-relative curve errors accumulate, producing larger CD and sometimes invalid topology despite higher ACCparam.The paper illustrates intersecting loops in an Alt-Rel output and a worse-CD Alt-Trans example.Source: Figure 4 · p. 6, §4.1 · p. 7
  • An autoencoder trained on the Onshape-derived dataset achieves comparable quantitative performance on a smaller dataset constructed from Autodesk Fusion 360 designs.The quantitative results are reported in the supplement.Source: §4.1 · p. 7

4.3. Future Applications

  • For point-cloud-to-CAD reconstruction, PointNet++ encodes a point cloud into the autoencoder’s latent space, which the decoder converts into a CAD model.The paper presents visual examples and supplementary quantitative results.Source: §4.3 · p. 8
  • Generated CAD models can be imported into CAD tools for direct user editing, unlike point clouds or polygon meshes, which are more troublesome to edit.The paper illustrates edits to regions undergoing CAD operations.Source: §4.3 · p. 8, Figure 7 · p. 8

5. Discussion and Conclusion

DeepCAD presents a generative model for CAD designs represented as command sequences, alongside a dataset of CAD models. Its current command coverage is limited, and it cannot guarantee topological validity, especially for long sequences.

  • The model currently considers line, arc, and circle commands; adding other curves or revolving sketches appears feasible, but boundary-dependent operations such as fillet remain future work.Fillet requires a reference to the model’s B-rep, not just other commands.Source: §5 · p. 8
  • The network cannot guarantee topological soundness of generated CAD sequences, although failures are rare in practice and become more likely for quite long sequences.The authors present and analyze failure cases in supplementary Sec. F.Source: §5 · p. 8
  • DeepCAD is presented as, to the authors’ knowledge, the first generative model for CAD designs and introduces a dataset of CAD models represented as command sequences.Previous 3D generative models almost all produce discrete representations such as voxels, point clouds, and meshes.Source: §5 · p. 8

A. CAD dataset

The dataset comprises user-created CAD construction sequences parsed from Onshape’s online repository, covering diverse mechanical parts. Its description includes measures of sequence length and extrusion counts, as well as filtering to reduce train–test duplicates.

A. CAD dataset

  • The dataset is parsed from Onshape’s online repository and consists mostly of diverse, user-created mechanical parts rather than category-specific shapes.The paper shows example models in Fig. 9.Source: A. CAD dataset · p. 12
  • The dataset derives from ABC [23], and test shapes are discarded when their nearest training-set neighbor by chamfer distance falls below a threshold.Source: A. CAD dataset · p. 12
  • Most CAD command sequences are no longer than 40 commands or use fewer than 8 extrusions, consistent with models being manually created by users.A similar command-length distribution is reported in Fusion 360 Gallery [48].Source: A. CAD dataset · p. 12, Figure 8 · p. 12

B. Command Parameter Representation

CAD command parameters are represented by normalizing model and sketch geometry, then quantizing continuous values while retaining discrete parameter values directly.

B. Command Parameter Representation

  • The full command parameter vector contains 16 values: [x, y, α, f, r, θ, φ, γ, px, py, pz, s, e1, e2, b, u].These parameters are normalized and quantized.Source: B. Command Parameter Representation · p. 12
  • Each CAD model is scaled within a 2 × 2 × 2 cube without translation, bounding plane origins and extrusion distances to [−1, 1], profile scale to [0, 2], and orientation angles to [−π, π].Source: B. Command Parameter Representation · p. 12
  • Each sketch profile is normalized to a unit square with its bottom-left starting point at (0.5, 0.5), bounding endpoint coordinates and circle radius to [0, 1], while arc sweep lies in [0, 2π].Source: B. Command Parameter Representation · p. 12
  • Continuous parameters are quantized to 256 levels as 8-bit integers, while discrete parameters retain their values directly; f encodes arc direction, b CSG operation, and u extrusion type.For f, 0 means clockwise and 1 counter-clockwise; b values 0–3 mean new body, join, cut, and intersect; u values 0–2 mean one-sided, symmetric, and two-sided.Source: B. Command Parameter Representation · p. 12

C. Network Architecture and Training Details

The CAD autoencoder uses a four-layer Transformer encoder and decoder, while generation uses an MLP latent GAN; the network is trained with WGAN-gp and Adam.

D. Autoencoding CAD models

The section compares CAD autoencoding variants and reports that arc sweeping-angle recovery is less accurate than other parameters, partly because arcs are used less often.

D. Autoencoding CAD models

  • Alt-Rel changes relative curve positions, Alt-Trans explicitly encodes loop starts, and Alt-ArcMid represents arcs by ending and middle positions.Alt-Trans includes the loop start in the extrusion command, whereas the proposed approach translates the sketch-plane origin to that start.Source: D. Autoencoding CAD models · p. 13
  • Alt-Regr uses mean-squared error for all continuous command parameters without quantization, while retaining cross-entropy for discrete parameters.Continuous parameters are normalized to [−1, 1] to balance errors across parameters.Source: D. Autoencoding CAD models · p. 13
  • Ours+Aug has a 50% chance of mixing sampled CAD sequences by switching sketch–extrusion pairs, excluding sequences with only one pair.The mixing is performed during training as data augmentation.Source: D. Autoencoding CAD models · p. 13
  • Table 4 reports mean, trimmed-mean, and median chamfer distances; outliers make mean CD scores much higher.The passage notes that scores become significantly large when outliers are included.Source: D. Autoencoding CAD models · pp. 13–14, Table 4 · p. 13
  • Arc sweeping-angle α has lower recovery accuracy than other parameters because its values span [0, 2π] more evenly and arc commands are less frequent.The authors conclude that these properties make α harder to learn.Source: D. Autoencoding CAD models · p. 14

E. Generalization on Fusion 360 Gallery [48]

The autoencoder was tested on Fusion 360 Gallery [48] after training on the proposed dataset, and performed well on shape distributions different from those seen in training.

E. Generalization on Fusion 360 Gallery [48]

  • The autoencoder trained on the proposed dataset was evaluated on Fusion 360 Gallery [48] in a cross-dataset shape-autoencoding test.The proposed dataset uses models from the Onshape repository, while Fusion 360 Gallery designs come from Autodesk Fusion 360.Source: E. Generalization on Fusion 360… · p. 14
  • Despite the datasets’ different sources, the model performed well on shape distributions unlike its training data.The qualitative and quantitative results are referenced in Fig. 10 and Table 5, respectively.Source: E. Generalization on Fusion 360… · pp. 14–15

F. Failure Cases

DeepCAD is more likely to produce invalid CAD commands for long sequences. The difficulty stems from maintaining valid topology and from the dataset’s imbalance toward shorter sequences.

F. Failure Cases

  • Invalid CAD commands become more likely as the sequence length increases.Figure 12 plots median CD scores and parameter accuracies by sequence length.Source: F. Failure Cases · p. 15
  • Figure 11 shows failures involving invalid topology and misplaced small sketches.The gray shape has invalid topology, while the yellow shape has misplacement of small sketches.Source: F. Failure Cases · p. 15
  • Long sequences are harder to generate because valid topology is harder to ensure and the long-tailed dataset has far fewer long sequences, potentially biasing the model toward short ones.Source: F. Failure Cases · p. 15

G. Metrics for Shape Generation

Shape generation quality is evaluated using three metrics previously used for point-cloud generation, after converting CAD models into point clouds. The metrics compare reference and generated shape sets, with scores averaged over three evaluation runs.

  • CAD models are converted to point clouds to compute three shape-generation metrics by comparing reference and generated sets.The metrics follow [6], where they were motivated for evaluating point-cloud generation.Source: G. Metrics for Shape Generation · p. 15
  • Coverage (COV) measures diversity as the fraction of reference shapes matched by at least one generated shape using Chamfer distance.A reference shape is matched to its nearest generated shape.Source: G. Metrics for Shape Generation · p. 15
  • Minimum matching distance (MMD) measures fidelity by averaging each reference shape’s Chamfer distance to its nearest generated neighbor.Source: G. Metrics for Shape Generation · p. 15
  • Jensen-Shannon Divergence (JSD) measures similarity between reference and generated sets through their marginal point distributions.The distributions are approximated by assigning points to a discretized space of 283 voxel grids.Source: G. Metrics for Shape Generation · p. 15
  • Evaluation uses 1,000 reference shapes and 3,000 generated shapes, with scores averaged over three repeated runs to reduce sampling bias.Source: G. Metrics for Shape Generation · p. 15
Loading 2105.09492v2…