Abstract: Engineering sketches form the 2D basis of parametric Computer-Aided Design (CAD), the foremost modeling paradigm for manufactured objects. In this paper we tackle the problem of learning based engineering sketch generation as a first step towards synthesis and composition of parametric CAD models. We propose two generative models, CurveGen and TurtleGen, for engineering sketch generation. Both models generate curve primitives without the need for a sketch constraint solver and explicitly consider topology for downstream use with constraints and 3D CAD modeling operations. We find in our perceptual evaluation using human subjects that both CurveGen and TurtleGen produce more realistic engineering sketches when compared with the current state-of-the-art for engineering sketch generation.
Introduction: The Foundation of Parametric CAD
In modern manufacturing, almost every physical object begins its life as a 2D engineering sketch within a Computer-Aided Design (CAD) environment. These sketches are not merely drawings; they are structured collections of geometric primitives—lines, arcs, and circles—that must satisfy precise topological requirements, such as forming perfectly closed loops, to be extruded into 3D volumes.
Traditionally, generating these sketches via AI has been difficult because they are governed by strict geometric constraints (e.g., tangency, perpendicularity, and symmetry). Previous state-of-the-art models attempted to predict these constraints first and then relied on a symbolic "constraint solver" to generate the final geometry. However, this approach is often computationally expensive and prone to failure. This research explores whether neural networks can learn to generate realistic geometry and topology directly, capturing the implicit rules of engineering design without an external solver.
Generative Architectures: CurveGen and TurtleGen
To address this challenge, two distinct Transformer-based architectures were developed:
- CurveGen: This model approaches sketch generation as a hypergraph prediction task. It first predicts a set of 2D vertices and then predicts "hyperedges" that group these vertices into primitives. The model uses implicit primitive typing: a group of two points defines a line, three points define an arc, and four points define a circle.
- TurtleGen: Inspired by "Turtle Graphics," this model generates a sequence of sequential pen commands (e.g.,
line,arc,loopstart). By "walking" the path of the sketch, it ensures the creation of continuous, closed loops.
Both models are autoregressive, predicting the next element of a sketch based on the previously generated geometry, allowing them to maintain global coherence.
Dataset Integrity: The Challenge of Duplication
The models were trained on the SketchGraphs dataset, which contains approximately 9.8 million sketches from the Onshape CAD platform. A critical contribution of this work was the discovery that the raw dataset was highly repetitive; a rigorous de-duplication process revealed that 87.01% of the data consisted of duplicates. After filtering for uniqueness and geometric validity, a refined set of 1.1 million sketches was used for training, ensuring the models learned from a diverse range of human designs.
Key Results and Perceptual Evaluation
The performance of the models was evaluated based on both technical validity and human-perceived realism.
- Validity: CurveGen demonstrated superior technical performance, producing valid sketches (defined by successful curve fitting and closed loops) 81.5% of the time. This significantly outperformed TurtleGen (42.9%) and the previous SketchGraphs baseline (65.8%).
- Realism: In a perceptual study, human subjects were asked to distinguish between computer-generated and human-designed sketches. CurveGen was rated as the most realistic, with its outputs being mistaken for human designs more frequently than any other model.
These results suggest that deep learning models can implicitly learn to obey engineering constraints simply by observing the final coordinates of human-designed sketches. By prioritizing topology—knowing exactly how primitives connect—these models produce "3D-ready" outputs that can be immediately used in CAD workflows.
Limitations and Future Outlook
While CurveGen and TurtleGen excel at generating realistic shapes, they currently lack the ability to handle explicit user-defined dimensions (e.g., specifying a line of exactly 10.5mm). They are currently optimized for "unconstrained" brainstorming rather than precision engineering. Future research will focus on conditional generation—allowing models to transform rough hand-drawn scribbles or 3D scans into clean parametric sketches—and the generation of higher-order constructs like mirrored features and circular arrays.
Summary updated