LLMs for CAD: Script Generation as the Gateway to the Physical World
Large language models excel at semantic understanding and code generation, while CAD systems demand hard constraints, precise geometry, and verifiable engineering output. This article explains why CAD is a key entry point for bringing LLMs into the physical world, breaks down the core capabilities involved—natural language to parametric scripts, part-level editing, multimodal industrial data fusion, and cloud-native 2D/3D integration—and outlines a reference architecture, a script generation workflow with sandbox execution and regression validation, quality assurance practices, and a phased adoption path for engineering teams.
1. Why CAD Is the Entry Point to the Physical World
A CAD model is not just geometry—it is a structured representation of the physical world. A usable 3D model typically carries dimensions, constraints, materials, assembly relationships, manufacturing features, version information, and BOM semantics. It connects downstream to simulation, manufacturing, and operations, and upstream to requirements, standards, and collaboration workflows. CAD is therefore both the entry point for engineering data and the critical interface through which LLMs move from “text and code” toward the physical world.
LLMs are strong at semantic understanding, code generation, multimodal fusion, and tool-call planning. CAD, by contrast, is hard because of rigid constraints, exact geometry, feature history, and the need for engineering verifiability. The right way to combine them is not to have the model “draw” directly, but to let it handle intent parsing, script planning, parameter filling, constraint checking, and result explanation—converting natural language intent into auditable, rollback-capable, reproducible modeling scripts. This lowers the barrier to professional scripting, improves efficiency for repetitive modeling, batch variants, and part-level modifications, and in turn increases tool usage frequency and design asset reuse.
2. Core Capabilities
2.1 Natural Language to Parametric Scripts
Natural language input often includes object types, dimensions, constraints, materials, assembly relationships, and context. The system should first perform slot extraction and unit normalization, then retrieve enterprise modeling standards, templates, and historical scripts, and finally generate a parametric script skeleton. Scripts should not hardcode values; they should output a parameter table, constraint expressions, and feature-order descriptions. For example, “generate a flange with mounting holes, 120 mm outer diameter, evenly spaced holes” should be parsed into parameters such as outer diameter, hole count, hole diameter, bolt circle diameter, material, and chamfer rules, then passed into constraint validation.
2.2 Part-Level Editing: Geometry, Materials, and Scene Layout
The key to part-level editing is locating the feature tree or part ID and modifying parameters and constraints first, rather than directly editing geometric faces. Based on user descriptions, an LLM can generate a script chain such as “modify a single part — adjust geometry parameters — replace materials — update scene layout,” while keeping operations idempotent and reversible. Materials and scene layout also require attention to rendering performance, naming conventions, and asset references, so that visual changes do not break engineering semantics.
2.3 Multimodal Industrial Data Fusion
Drawings, point clouds, meshes, process documents, and simulation reports can all serve as context. Multimodal models can help recognize drawing annotations, extract manufacturing constraints, and align model and document semantics, but retrieval augmentation and rule-based validation are required to suppress dimensional hallucinations. Industrial data needs governance: unified units, naming, versions, permissions, and data masking policies, along with traceable samples and evaluation sets.
2.4 Integrated 2D + 3D + Cloud
2D drawings and 3D models must stay in sync: 2D annotations and constraints can map to 3D parameters, and 3D changes should generate drawing diff reports. On the cloud side, script execution, model assets, version auditing, and access control fit naturally in cloud environments. For cloud deployment, generic capabilities such as compute, object storage, container platforms, and logging/monitoring—of the kind offered by Baidu AI Cloud—can support sandboxed script execution and model asset management. The point is not piling up resources, but achieving isolation, observability, and auditability.
3. Reference Architecture
A practical system can be organized into six layers:
- Interaction and intent parsing layer: handles natural language, drawings, and parameter tables as input.
- Knowledge retrieval layer: loads design standards, templates, historical scripts, and material libraries.
- Planning and script generation layer: performs task decomposition, parameter filling, and script synthesis.
- Constraint validation layer: runs checks on units, dimension chains, assemblies, and manufacturing rules.
- Execution layer: calls the geometry kernel or CAD scripting APIs inside a sandbox, collecting geometry metrics and logs.
- Asset and audit layer: stores scripts, parameters, results, diffs, and approval records.
Every layer should return structured error codes and explainable outputs so engineers can review them easily.
4. Script Generation Example
The following is neutral pseudocode illustrating the closed loop of “intent — validation — script — sandbox — regression.” It does not represent any specific product API:
intent = "Generate a flange with evenly spaced mounting holes, 120mm outer diameter, common structural steel"spec = parse_intent(intent)spec = normalize_units(spec, target_unit="mm")rules = load_design_rules(part_type="flange")assert validate_constraints(spec, rules) # dimension chains, hole spacing, wall thickness, etc.script = synthesize_script(spec, api_profile="generic_cad")assert static_check(script) # syntax, permissions, dangerous call checksresult = execute_sandbox(script, timeout=60)metrics = measure_geometry(result) # outer diameter, hole positions, volume, interference, etc.assert regression_compare(metrics, baseline_set)report = diff_and_explain(result, spec)
The workflow emphasizes four principles: units first, constraints up front, sandboxed execution, and metric-based regression. Scripts generated by the model must not go straight into production; critical dimensions, assembly relationships, and manufacturing features require engineer approval. On failure, the system should roll back to the previous version and retain an explanation report.
5. Quality Assurance and Engineering Practices
First, determinism and idempotency. Scripts should be parameterized and repeatable, with stable feature ordering and rollback on failure. Second, multi-level validation. Beyond syntax and static checks, add geometry measurement, engineering rule checks, assembly interference detection, and simulation where necessary. Third, baseline regression. Build evaluation sets of typical parts and assemblies, run regressions after every model or template update, and output diff reports. Fourth, security and compliance. Run scripts in isolated sandboxes, apply least-privilege access, keep audit logs, and mask sensitive industrial data. Fifth, human-AI collaboration. Have the model explain “why this change was made,” and let engineers approve only high-risk changes. Useful metrics include script first-pass rate, rework rate, modeling time, asset reuse rate, and constraint violation rate—but avoid promising specific performance figures without real data.
6. Adoption Path
Phase one: assistive scripting and template recommendation, covering repetitive parts and standard components. Phase two: part-level automation, batch variants, and drawing-model linkage, backed by a constraint rule library. Phase three: multimodal data fusion and cloud-based collaboration, forming an auditable design asset loop. Organizationally, this requires digitized design standards, well-wrapped scripting APIs, knowledge base maintenance, and evaluation set construction. Cost-benefit analysis should be based on real modeling tasks, comparing script maintenance costs, rework costs, and asset reuse gains—technical capability alone should not be equated with business outcomes.
7. Conclusion
CAD is the gateway to the physical world; LLMs are the bridge from intent to script. What delivers real value is not “generating a plausible-looking piece of code,” but wiring natural language intent, parameter constraints, script execution, geometry validation, and cloud-based auditing into an engineering closed loop. Developers should prioritize constraint validation, sandboxed execution, and regression evaluation before gradually expanding into multimodal and collaboration capabilities. This approach improves modeling efficiency and tool adoption while keeping model outputs controllable, explainable, and traceable.
