LLMs in CAD: From Script Generation to a Physical-World Data Gateway

    This article examines why the real bottleneck in CAD automation is the translation of design intent into executable scripts rather than the modeling kernels themselves, and why generative models fit that task unusually well. It presents a five-layer closed-loop reference architecture: input understanding with a structured intermediate representation, intent and planning, retrieval-augmented script generation, deterministic execution and verification, and a modification layer for ongoing use. It also covers asset construction and local edits, scene and layout handling, 2D/3D and cloud integration, and the engineering priorities that determine real-world outcomes: model tiering and cost control, knowledge assets built ahead of model selection, business-aligned evaluation metrics, and clear boundaries on what the technology can currently do.

    1. Where CAD Automation Actually Gets Stuck: Expressiveness, Not Execution

    Industrial modeling kernels have been powerful for a long time. Mainstream parametric kernels support feature-based modeling, assembly constraints, constraint solving, boolean operations, and surface modeling, and their scripting interfaces come with complete event and API systems. What constrains efficiency is something else entirely: translating design intent into scripts that are executable, maintainable, and reusable. That work depends heavily on an engineer’s experience, their understanding of kernel semantics, and their memory of template conventions.

    Three persistent pain points follow from this:

    • Heavy templating effort. Standard parts libraries, sheet metal parts, extrusions, jigs and fixtures — a large share of mechanical design is highly repetitive, yet every instance still requires an engineer to drive hundreds of feature operations manually.
    • Script assets do not accumulate. Modeling scripts accumulated inside a company tend to live scattered across personal directories, without semantic annotation and without any way to retrieve them for reuse. Without an owner who knows them, they degrade into one-off code.
    • Design knowledge stays tacit. Process rules, tolerance requirements, and interference-checking experience mostly live in the heads of senior engineers and are hard to apply automatically at modeling time.

    This is exactly where AI coding assistants enter the CAD workflow: rather than asking engineers to memorize kernel details, they let engineers express intent in natural language and visual input, and leave the model to translate that intent into scripts and maintain those scripts over time.

    2. Why LLMs Suit the CAD Scripting Task

    CAD scripts differ from general-purpose code in a few ways that align well with the current capabilities of generative models:

    1. Strongly formalized, relatively unambiguous. Modeling scripts call deterministic kernel APIs with clearly defined parameter semantics. When execution fails, the error surfaces immediately in the geometry itself, so the feedback signal is very clear.
    2. Highly repetitive and composable structure. Most complex parts are assembled from sequences of standard features. The problem is essentially a mapping from high-level intent to a feature sequence with parameter constraints, not open-ended creative writing.
    3. Strong verifiers available as a backstop. A geometry kernel can determine whether a result is valid, which means generation does not need to be right on the first attempt. A generate–execute–verify–repair loop is viable.

    The other half of model capability matters just as much here: multimodal understanding. Design input is often not text but 2D engineering drawings, scanned point clouds, photographs, hand-drawn sketches, or existing renders. The value of a multimodal model is mapping pixels and drawing elements onto geometric semantics — faces, axes, hole positions, symmetry relationships. That step has traditionally required manual drawing interpretation, and it is the largest single break in the automation chain.

    3. A Reference Architecture: A Five-Layer Closed Loop

    To turn generation capability into an engineering system, separate responsibilities into layers rather than building a black box that takes a prompt and returns code.

    3.1 Input Understanding Layer

    This layer accepts drawings, sketches, point clouds, text descriptions, or existing models as constraints. It outputs a unified structured intent description — a JSON intermediate representation containing the part category, datum references, key dimensions, feature list, and material and process requirements. The critical output of this layer is the intermediate representation, which decouples everything downstream from any specific CAD application.

    3.2 Intent and Planning Layer

    The intermediate representation is decomposed into an executable modeling plan: choose the datum coordinate system, determine modeling order (so no feature references an object that has not been created yet), establish feature dependencies, and identify which dimensions are free to parameterize. The value of this layer is resolving constraint conflicts — for example, whether to cut holes before or after chamfering.

    3.3 Script Generation Layer

    Generate against the company’s private script library using retrieval-augmented generation rather than relying on the model’s memory alone. The retrieval granularity should be feature-level snippets — reusable units such as gusset-plate bending, gear parameterization, or patterned ribs — each carrying its input/output signature and applicability conditions.

    1. # Illustrative pseudocode: from intermediate representation to
    2. # modeling plan to generated script
    3. plan = build_plan(intermediate_spec) # includes datums, order, dependencies
    4. context = retrieve_snippets(plan.features) # retrieval from the private snippet library
    5. script = model.complete(
    6. system=MODELING_PROMPT, # kernel API semantics and constraint documentation
    7. context=context, # reusable snippets + dimensional standards
    8. task=plan.as_prompt(), # structured modeling plan
    9. )
    10. result = kernel.execute(script) # execute in a controlled kernel environment
    11. if not check(result):
    12. feedback = collect_violations(result) # topology/interference/tolerance violations
    13. script = model.repair(script, feedback) # targeted repair with feedback

    3.4 Execution and Verification Layer

    This layer decides whether the whole system is usable in production. Verification must not be left to the model’s own judgment; it must be performed by a deterministic toolchain that covers at least:

    • Geometric validity: whether the solid is closed and its volume is computable, whether any self-intersecting faces exist, whether the shell has degenerated.
    • Topology and parameter consistency: whether the feature tree contains dangling references, whether a parameter change causes a rebuild to fail.
    • Assembly interference and clearance: whether the part collides with neighbors, whether the motion envelope exceeds bounds.
    • Dimensions and tolerances: whether critical dimensions fall within annotated ranges, whether any corporate tolerance standard is violated.
    • Manufacturability rules: minimum wall thickness, fillet radii, draft angles, tool accessibility.

    Violations are returned to the model as a structured list, and the model is responsible only for locating and repairing them. This converts uncertain generation into auditable iteration.

    3.5 Modification and Operations Layer

    Generated scripts must remain editable by engineers over time. A workable approach is to externalize all dimensions, materials, and assembly placements into a parameter table and expose an entry point for local changes: editing the size of a single component recomputes only the affected downstream features and assembly relationships instead of rebuilding everything. This is also what drives adoption frequency — engineers use the system daily, and that produces the high-quality script samples that feed back into the retrieval library.

    4. Asset Construction, Local Edits, and Scene Layout

    In practice, generating a single part is rarely the end goal; it is usually the starting point for a visual asset or a scene assembly.

    • Asset construction and refinement: start from coarse block geometry and refine in successive passes — chamfers, reinforcing structures, surface texture, lightweighting features — submitting only the minimal change set each round.
    • Single-component modification: parameter-table-driven local recomputation avoids the performance and stability risks of full rebuilds.
    • Geometry, material, and layout adjustments: materials and appearance properties are rendering-side data and should be managed separately from the geometry itself. Scene layout needs to handle camera views, lighting, and environment maps; this is better generated from descriptive input plus parameterized templates, then executed deterministically by the rendering engine.

    5. Unifying 2D, 3D, and the Cloud

    Integrated design comes down to a unified data model and unified service boundaries:

    • Bidirectional linking between 2D drawings and 3D models, so dimension changes stay synchronized and the two data sets do not drift apart over time.
    • Modeling the geometry kernel as a service: package modeling, verification, lightweighting, and format conversion as remotely callable services, so desktop, web, and automation pipelines share one kernel implementation.
    • Cloud-based collaboration: store versioned models and script assets in object storage, decouple recomputation jobs with a message queue, use a container platform to absorb rendering and batch-verification loads elastically, and build observability for generation tasks with logging, monitoring, and alerting.
    • Permissions and auditing: scripts that can execute carry code-execution risk. They must run in a sandbox, with operation auditing, change traceability, and rollback capability.

    6. Implementation Priorities and Evaluation

    Model tiering and cost control. Route simple parameter filling and format conversion to small models or rule engines, and reserve large models for complex intent parsing and repair. Apply semantic caching and result reuse to high-similarity repeated requests, and schedule batch modeling jobs off-peak.

    Knowledge assets before model selection. What sets the ceiling on results is usually the company’s own feature snippet library, drawing standards, and verification rule set — not which model was chosen. Lock down the verifiers and the retrieval library first, then connect generation.

    Evaluation metrics must reflect the business. Useful quantitative measures include first-pass script execution success rate, average number of repair rounds, geometric validity rate, critical-dimension hit rate, how many times a generated script is reused within thirty days, and the reduction in average modeling time per engineer. Without these metrics, the return from generative capability is very hard to demonstrate.

    Be explicit about capability boundaries. The more mature scenarios today are standard parts, repetitive structures, template variants, initial drawing-to-model conversion, and batch parametric rework. Inferring design intent for freeform topology surfaces and solving global constraints for very large assemblies still require engineers to drive decisions.

    7. Conclusion

    The significance of LLMs for CAD is not that they replace engineers, but that they sharply reduce the cost of converting design intent into geometric solids, freeing engineers to focus on trade-off decisions and process judgment. When modeling scripts can be generated naturally, verified deterministically, and reused continuously, CAD stops being an isolated drafting tool and becomes a unified data gateway connecting design, simulation, and manufacturing — the most valuable link in the digitization of the physical world.