LLMs for CAD: From Script Generation to Parametric Modeling
How large language models generate and execute CAD scripts from natural language, and how parametric modeling, 2D/3D/cloud platform architecture, evaluation metrics, and governance turn AI-assisted design into a reliable engineering workflow. This article covers intent parsing into structured parameters, feature dependency validation, multimodal input handling, data feedback loops, and a phased adoption path—giving engineers and platform architects a practical framework for building an LLM-powered CAD pipeline.
1. Introduction: How Large Language Models Enter CAD
In mechanical manufacturing, tooling, sheet metal, consumer electronics, and related industries, CAD is the starting point for almost every physical product. Engineers define dimensions and features in CAD, then move through assembly, engineering drawings, simulation, and CNC machining to turn the digital model into a real part. Over recent decades the CAD modeling kernel has matured steadily, but the way people interact with it has changed little: menus, toolbars, a feature tree, and mouse clicks. Mastering a complex system of constraints and features can take a new engineer months or longer.
The industry has long offered automation, such as writing macros in a scripting language and building parametric models. Traditional scripting, however, requires users to understand both geometric modeling logic and API details, so the barrier is far from low. What large language models change is this: an engineer only needs to describe intent in natural language—for example, “change the base plate thickness to 10 mm, convert the four mounting holes to countersunk holes, hole diameter 8 mm”—and the system locates the relevant parameters and features, generates a script, hands it to the CAD kernel for execution, and renders the result for the engineer to review. If the result falls short, the engineer keeps refining through dialogue. The script shifts from “code the engineer must actively write” to “an intermediate artifact the AI writes and executes behind the scenes.”
This looks like an interaction-level improvement, but it actually changes the economics of CAD automation. Using general-purpose scripts or the intelligent coding capabilities of an IDE, the cost of generating, combining, and modifying scripts in bulk is spread out, so a script library that once demanded heavy manual effort can now be built incrementally with AI assistance. The core value of this approach comes down to four points:
- Lower the barrier: design intent becomes an executable model directly, reducing menu hunting, constraint locating, and repetitive clicking.
- Free up creativity: AI takes on repetitive modeling, revisions, and validation, letting engineers focus on trade-offs and innovation.
- Accumulate knowledge: every generated script, parameter adjustment, and validation result can be stored and reused as a design asset.
- Connect to the physical world: structured parameters, features, and assembly relationships feed directly into drawing output, simulation, and manufacturing preparation, serving as the key entry point between digital design and physical production.
2. Core Mechanism: How Large Language Models “Read” and “Generate” CAD Scripts
2.1 Intent Parsing: Turning Natural Language into Structured Parameters
The skeleton of a CAD script is typically “parameters + feature sequence.” Parameters define design variables such as length, width, height, hole diameter, and fillet radius, while the feature sequence describes the modeling steps—sketching, extrusion, revolve, drilling, chamfering, patterning.
When a model generates a script, it does not directly emit hard-to-constrain free text. It first performs semantic parsing: extracting entities (objects), attributes (dimensions, material, quantity), and relationships (positioning, mating, symmetry, patterns) from natural language, then mapping them to a structured specification.
Sample input: “Design an L-bracket with a base plate of 200×150×8 mm, a vertical wall 100 mm high and 8 mm thick, four M8 mounting holes on the same side with hole centers 20 mm from the edge, and an R5 fillet where the wall meets the base plate.”
Structured output (illustrative):
{"part_type": "bracket","params": {"base_length": 200,"base_width": 150,"base_thickness": 8,"wall_height": 100,"wall_thickness": 8,"hole_diameter": 8,"edge_distance": 20,"fillet_radius": 5},"features": ["base_pad", "wall_pad", "hole_pattern", "edge_fillet"]}
A structured specification offers three advantages:
- Verifiable: ranges, types, units, and dependencies between parameters can all be checked automatically.
- Reusable: the same specification can be applied across a range of sizes to generate a family of similar parts.
- Traceable: scripts, parameters, and the feature tree map one-to-one, making it easy to locate and roll back.
In practice, teams usually define a “specification template” that constrains the model’s output, keeping the AI working within an existing design language. Establishing value ranges and unit conventions for key parameters—for example, standardizing on millimeters and drawing hole diameters from a standard series—effectively reduces “hallucinated parameters.” Parametric relationships (such as hole-center-to-edge distance being constant or plate thicknesses being equal) are best declared explicitly in the template rather than left to the model’s discretion.
2.2 Feature Dependencies and Execution Order: What Makes the Result Hold Up
A parametric model is essentially a directed dependency graph: later features often reference edges, faces, or solids produced by earlier features. If the generated script orders steps incorrectly—drilling holes before creating the base plate the holes belong to, for instance—it produces errors like “reference to a nonexistent geometric element.”
Such problems are hard for the model to avoid on its own, so in engineering practice two approaches are typically used:
- Template/skeleton constraints: the model fills parameter slots of an existing part family, and the template guarantees the structure.
- Dependency-graph validation: before the script executes, static analysis orders features by their dependencies and reports the location of failed references as feedback for the model to fix.
Input spec│▼Dependency-graph validation ──(cyclic/missing dependency found)──► Error feedback ──► Model revises script│(pass)▼Generate script ──► Kernel execution ──► Geometry/rule validation│(fail)└──► Revise and regenerate
# Illustrative pseudocode: natural-language spec → script generation → kernel execution → validation and correctionPARAM_SCHEMA = {"base_length": {"type": "float", "unit": "mm", "range": [50, 2000]},"base_width": {"type": "float", "unit": "mm", "range": [30, 1500]},"base_thickness": {"type": "float", "unit": "mm", "range": [3, 50]},"wall_height": {"type": "float", "unit": "mm", "range": [10, 1000]},"wall_thickness": {"type": "float", "unit": "mm", "range": [3, 50]},"hole_diameter": {"type": "choice", "options": [3, 4, 5, 6, 8, 10, 12]},"edge_distance": {"type": "float", "unit": "mm", "range": [5, 100]},"fillet_radius": {"type": "float", "unit": "mm", "range": [1, 20]},}# Expose whitelist operations only; disallow file I/O, network access, and similar capabilitiesALLOWED_OPS = {"param", "sketch", "extrude", "hole", "fillet", "chamfer", "pattern"}def generate_script(spec_text: str, template: dict, history: list) -> dict:"""Generate a design script with parameter slots based on the spec template and correction history"""prompt = build_prompt(instruction=SYSTEM_PROMPT,schema=PARAM_SCHEMA, # parameter types, units, and value rangestemplate=template, # reusable feature skeletonhistory=history, # error and correction records from prior roundsuser_spec=spec_text, # the engineer's natural-language description)script = llm_service.complete(prompt, response_format="json")return {"params": fill_slots(script, template), # fill parameters into template slots"ops": pick_ops(script, ALLOWED_OPS), # keep only whitelisted operations"deps": script.get("dependencies", []), # reference relationships between features}def design_loop(spec_text: str, template: dict, max_iter: int = 3):history, ops, params = [], None, Nonefor _ in range(max_iter):script = generate_script(spec_text, template, history)# 1. Dependency-graph validation: detect cyclic/missing references and reorder topologicallyordered = topo_sort(script["ops"], script["deps"])if ordered is None:history.append({"error": "circular_or_missing_dependency", "detail": script})continue# 2. Kernel execution: solve sketch constraints, build features, perform Boolean operationsresult = kernel.execute(ordered, script["params"])if not result.ok:history.append({"error": "kernel_failed", "detail": result.message})continue# 3. Multi-dimensional validation: topology validity, geometric validity, design rules, manufacturabilitychecks = merge_checks(check_topology(result.body), # manifold, no self-intersection, closed solidcheck_geometry(result.body), # positive volume/area, no zero thicknesscheck_design_rules(result.body, rule_set), # minimum wall thickness, chamfer radius, etc.check_manufacturing(result.body), # tool reachability, draft angle, machining feature consistency)if checks.passed:# 4. Output the model, editable script, and parameters, preserving the full correction chainreturn {"model": result.body, "script": ordered, "params": script["params"]}history.append({"error": "validation_failed", "issues": checks.issues})# 5. Retry limit exceeded: stop and hand off to a human, avoiding an infinite loopraise RuntimeError("design_not_converged")# Local modification: rerun only affected features instead of rebuilding the entire modeldef modify_part(model, param_path: str, new_value):return design_loop(spec_text=f"Change {param_path} to {new_value}",template=model.template,)
This pseudocode reflects the key principle of generative CAD: the model does the “thinking,” the kernel does the “computing,” and validation does the “judging.” Whether geometry is valid and whether it can be manufactured depend not on the language model but on the kernel and rule engine. When validation fails, the error information is fed back into the dialogue context in structured form, and the model makes targeted fixes rather than starting over.
2.3 Asset Creation, Local Revision, and Scene Presentation
In real design workflows, AI-assisted modeling typically covers these scenarios:
- Asset creation: generating basic geometry from scratch—standard parts, connectors, brackets, housings—and automatically filling in details such as hole patterns, chamfers, and draft angles according to standard series.
- Parametric revision: deriving similar specifications from an existing model. For example, when a bracket family expands from a 200 mm series to a 300 mm series, you only change parameters and re-solve the constraints, and the model keeps its structure consistent.
- Local modification: editing a specific feature or geometric element after locating it—changing a fillet on one side to a chamfer, adding a reinforcing rib, or repositioning a hole.
- Geometry, material, and scene layout: adjusting dimensions and positional relationships, assigning material and appearance attributes to parts, and setting part poses and relative positions in an assembly environment for lightweight or visualization presentations.
Among these scenarios, local modification is the hard part. Phrases in natural language such as “this hole,” “the edge on the left,” and “the fillet I just added” contain references that require the model to perform semantic resolution using the feature tree, the selection set, and the dialogue history. A workable approach is to have the system map natural language to a “feature/element selection set + operation intent,” then invoke the corresponding API. For example, “change that fillet I just made to a C2 chamfer” is parsed as:
{"target": {"feature_type": "fillet", "ref": "last_created"}, "op": "replace_with", "args": {"chamfer_size": 2}}
2.4 Multimodal: Letting AI Read Drawings, Sketches, and Physical Objects
Design inputs go well beyond text, and the multimodal capabilities of large language models let a CAD assistant handle more forms of information:
- Engineering drawing parsing: recognizing views, dimension annotations, geometric tolerances, and surface finish requirements, then comparing them against the model to catch drawing-model inconsistencies.
- Hand-drawn sketches/whiteboard photos: recognizing outlines and key dimensions to help generate an initial sketch or parameter scheme.
- Point clouds and scan data: serving as references for reverse modeling to help fit basic geometry.
- Product photos and renders: helping generate appearance schemes or material suggestions.
One basic principle applies here: multimodal output is used for understanding and suggestions; the final geometry must land on parameters and features. Generating a mesh directly from an image tends to produce a “dead model” with irregular topology that cannot be edited. Only results carried by parametric features can move on to downstream drawing, simulation, and manufacturing stages.
2.5 The Data Feedback Loop: Where the Value of Industrial Data Lies
The ceiling on what large language models can do in industrial software depends largely on how domain knowledge is accumulated. A fairly practical path has three layers:
- Document knowledge: design manuals, standards and specifications, enterprise drafting standards, and material and process references, which retrieval-augmented generation (RAG) can supply to the model as evidence.
- Parametric model library: abstracting historical models into “parameters + features + assembly relationships” templates that cover typical part families.
- Engineer interaction feedback: acceptances, rejections, manual edits, and final deliverables are all natural supervision signals that can be used to keep optimizing the model.
The most easily overlooked yet most valuable layer is interaction feedback. Every time an engineer accepts or adjusts an AI-generated script, they are essentially labeling “what kind of modeling approach fits this company’s design standards.” Only by systematically collecting, cleaning, and feeding these signals back does the model grow to better understand the company’s design language over time.
3. System Design: An Integrated 2D + 3D + Cloud Platform Architecture
An individual part generated with AI assistance only solves the “point” problem. What enterprises really need is for design data to flow smoothly across 2D, 3D, and the cloud. An integrated platform is usually divided into five layers:
| Layer | Core Capabilities | Key Considerations |
|---|---|---|
| Interaction layer | Dialogue, sketch input, drawing upload, lightweight web viewing | Link sessions to model state; support multi-turn references |
| Intelligent orchestration layer | Intent parsing, template selection, script generation, multi-step task planning, validation and correction | Constrain output with specification templates; whitelist tool calls |
| CAD kernel service layer | Sketch constraint solving, parametric feature modeling, assembly constraints, drawing projection | Stateless and elastically scalable; set a per-execution timeout |
| Data and knowledge layer | Template library, standard-parts library, standards documents, historical interaction data | Combine vector and keyword retrieval; manage data by classification level |
| Infrastructure layer | Object storage, message queues, container platform, logging, monitoring and alerting | Make tasks asynchronous; keep the full chain observable |
2D/3D collaboration is central to integrated design. Engineering drawings are generated by projecting the 3D model and adding annotations automatically; when the model changes, the affected views, dimensions, and bill-of-materials details update accordingly. AI can help in both directions:
- Forward: present the 3D scheme and a 2D drawing preview together in the dialogue, reducing back-and-forth switching.
- Reverse: parse an existing 2D drawing to help reconstruct the 3D model, or compare drawing against model to find mismatches between dimension annotations and the model.
Cloudification solves collaboration and compute problems:
- Place compute-intensive tasks such as geometric solving and rendering in the cloud, scaling up and down on demand.
- Use object storage to hold design assets like model files, scripts, and render results.
- Use message queues to queue and asynchronously dispatch modeling tasks and return results to the frontend.
- Use logging, monitoring, and alerting to track generation success rates, kernel execution time, and resource usage, catching anomalies early.
On a cloud provider’s intelligent-compute services, you can deploy multimodal large-model inference, fine-tuning, and vector retrieval capabilities. The specific choices and interface design should be decided based on data-compliance requirements and the actual situation—public cloud, private deployment, or hybrid.
4. Evaluation: Using Metrics to Verify “Usable” and “Good to Use”
Whether AI-assisted modeling truly delivers value must be measured with quantifiable, reproducible metrics rather than left at the level of a demo. A four-dimensional evaluation system is recommended:
Correctness
- Kernel execution success rate;
- Topological validity (no self-intersection, closed solids, manifold structure);
- Specification conformance (dimensions, quantity, and positional relationships match the design intent).
Usability
- First-pass rate and average number of correction rounds;
- Whether the modified model stays parametric and editable;
- Whether the feature tree is clear and naming is consistent.
Efficiency
- Average time from requirement to a usable model for a single part;
- Time savings relative to manual modeling;
- The adoption rate of generated results by engineers.
Stability and Security
- Output consistency across similar inputs;
- Number of sensitive-data leakage incidents;
- Number of sandbox rule violations.
Evaluation requires a fixed test set, a fixed model version, and periodic regression testing to genuinely reflect how capabilities evolve. Among these metrics, adoption rate matters most: it directly shows whether engineers are willing to bring AI into their daily workflow. Only once it enters the real workflow can feedback data keep flowing back and form a positive loop.
5. Adoption Recommendations: A Phased Approach
- Phase 1, single-point validation: choose part families with a high degree of parameterization and clear rules—such as brackets, flanges, and sheet-metal parts—connect the template library and validation rules, run in parallel with the existing design process, and have engineers review the results.
- Phase 2, workflow integration: connect the script API, constraint solving, and drawing linkage, and embed AI-assisted modeling into the company’s existing data management system so that models, scripts, and versions stay traceable.
- Phase 3, multimodal and knowledge base: add capabilities like drawing parsing and sketch recognition, build a standards-document and parametric-model library, and keep optimizing the model with interaction feedback.
- Phase 4, design agent: plan steps for a complete design task and automatically invoke capabilities for retrieval, modeling, validation, and drawing output, letting engineers focus on defining goals and making key decisions.
6. Risks and Governance
- Geometric correctness risk: generated results must be validated by the kernel and rule engine; keep a human confirmation step for critical designs, and never let AI directly decide safety-related parameters.
- Script execution security: run AI-generated scripts in a sandbox that allows only whitelisted API calls, restricts file and network access, and sets execution timeouts and resource limits.
- Data and intellectual property: enterprise drawings, parameters, and process materials are core assets and need access control and tiered management; for sensitive scenarios, prefer private or hybrid deployment.
- Prompt injection risk: external inputs such as drawing annotations and documents may carry malicious instructions; treat this content as data rather than instructions, and isolate it during parsing.
- Result explainability: every change should be traceable to the specific instruction, parameter change, and scope of impact, making review and accountability easier.
7. Conclusion
The combination of large language models and CAD is pushing design interaction from “operating a tool” toward “expressing intent.” In this chain, engineers describe goals, the model generates scripts, the kernel guarantees geometric correctness, and the validation system holds the quality line. An integrated 2D/3D/cloud platform then turns these capabilities into enterprise assets that can be accumulated sustainably.
From a longer view, every product in the physical world begins with a design model. Once the source of design is digitalized and made intelligent, the model—and the parameters and process knowledge behind it—can flow smoothly into simulation, manufacturing, and operations, becoming the key entry point where intelligent technology meets the physical world. For an enterprise, the real competitive edge lies not in whether it has adopted large language models, but in whether it can build a complete “data–template–validation–feedback” loop that lets AI genuinely understand and serve its own engineering practice.
