LLM-Assisted CAD Design: From Script Generation to Parametric Modification
This article explains how large language models can support CAD design by converting natural language intent into structured, validated modeling scripts. It covers a five-stage pipeline, restricted script generation, parametric modification with dependency analysis, material and layout handling, and the engineering constraints that make such systems reliable, including sandboxing, data security, version control, evaluation methods, and common risks.
1. Background: Repetitive Work in Design
In mechanical design, architectural design, and industrial product development, designers spend much of their time on repetitive operations. For example, a series of parts often requires the same adjustments to hole positions, wall thicknesses, or chamfer sizes. Assembly work involves placing components repeatedly, and material and rendering parameters must be set one by one according to a common standard. These tasks share a clear pattern: the rules are well defined and the variations are limited, yet they must be completed manually through step-by-step clicks in a graphical interface.
The text understanding and code generation abilities of large language models offer a new way to handle this kind of work. A designer describes intent in natural language. The system converts that intent into executable modeling instructions, and the design software’s scripting interface then builds the geometry. The core idea is not to have the model “draw” directly. Instead, the model generates a structured, verifiable sequence of operations.
2. Overview of the Technical Path
A practical system usually includes five stages:
- Intent understanding: Parse the user input and identify the objects, dimensions, constraints, and scope of modification.
- Structured conversion: Map the natural language to a unified parameter model, such as part type, feature list, and parameter values.
- Instruction generation: Generate modeling scripts from templates or a restricted grammar.
- Safety validation: Check the script for syntax, scope, geometric validity, and resource consumption.
- Execution and write-back: Call the design software interface in an isolated environment, record the operation log, and save a version.
Stages 2 and 4 determine the reliability of the system. LLM output is probabilistic, so executing generated code directly carries risk. A structured intermediate layer between the model and the executor is necessary.
3. From Natural Language to Modeling Scripts
3.1 Intent Parsing and Structured Description
A user enters: “Make a mounting plate 100 mm long, 60 mm wide, and 8 mm thick, with a 6 mm through-hole at each corner, and the hole centers 10 mm from the edges.”
The system should first extract the following fields: the object type is a plate, the dimensions are length, width, and thickness, and the features are four through-holes with a diameter of 6 mm and centers 10 mm from the edges. If the input lacks information such as material or tolerance, the system should ask the user rather than let the model make assumptions.
3.2 Restricted Script Generation
If a model generates scripts freely, it often produces nonexistent interfaces or out-of-range parameters. A safer approach is to define a whitelist of operations for the design software, such as creating a base body, adding a hole feature, or setting a chamfer. The model may only combine these whitelisted calls, and every parameter must fall within a predefined range.
Illustrative pseudocode:
part = create_base_body(type="plate", length=100, width=60, thickness=8)hole_positions = compute_corner_positions(part, offset=10)for pos in hole_positions:add_through_hole(part, center=pos, diameter=6)validate_geometry(part)
This code only illustrates the approach. The function names and parameters are examples and do not represent the interface of any specific software.
4. Parametric Modification of a Single Part
4.1 Building a Parameter Table
The basis of parametric design is separating dimensions and constraints from the geometry and storing them in a parameter table that can be read and written independently. When a user modifies a parameter, the system rebuilds the geometry from the constraints. For example, to change the hole diameter from 6 mm to 8 mm, the system updates the corresponding parameter and recalculates the features. It does not need to edit each point of the model.
4.2 Incremental Modification and Impact Analysis
A user says, “Change the thickness of this plate to 10 mm and keep the hole positions unchanged.” The system must determine whether the thickness change affects other features. If a feature’s position depends on the thickness, the system should warn the user. Incremental modification requires the system to record a dependency graph and calculate the impact scope before any change is applied.
Illustrative pseudocode:
change = {"part_id": "plate_01", "param": "thickness", "new_value": 10}affected = find_dependent_features(change)if not confirm_with_user(affected):abort()apply_parameter_change(change)rebuild(part_id="plate_01")
5. Adjusting Geometry, Materials, and Scene Layout
Besides geometry, design scenes include material assignment, color settings, and component placement. These operations can also be mapped to structured instructions.
- Materials: Select a material ID from the enterprise material library instead of letting the model type a material name freely. This prevents spelling errors and materials outside the library.
- Appearance: Apply a unified color and texture standard and limit the adjustable range.
- Layout: Describe positional relationships with assembly constraints, such as “the hole axes of the two parts are aligned” or “the end faces are in contact.” A solver then calculates the final positions, which reduces manual coordinate input.
Layout adjustment requires careful collision detection. After each placement, the system should calculate bounding boxes or exact interference and return a list of conflicts.
6. Key Constraints for Engineering Deployment
6.1 Geometry and Rule Validation
Generated geometry must pass several checks: whether the solid is closed, whether wall thickness meets the minimum value, whether hole edge distances extend beyond the plate boundary, and whether dimensions fall within standard ranges. When validation fails, the system should return the specific location of the error rather than a general failure message. This helps users or the model correct the problem in the next iteration.
6.2 Permissions and Sandboxing
Scripts should run in an isolated environment with only the minimum permissions needed for the task. The execution environment should not access arbitrary file paths or download external content from the internet. Each execution should also have a timeout and a memory limit.
6.3 Data Security and Copyright
Design drawings are usually core enterprise assets. Data sent to a model should be desensitized, transmitted over encrypted channels, and kept out of logs in plain text when it contains sensitive parameters. Data used for training or fine-tuning requires explicit authorization.
6.4 Versioning and Rollback
Every modification should create a new version and keep a record of the differences, so that any step can be rolled back. This matters most for collaborative design, where automated changes could overwrite work by other team members.
7. Evaluation Methods
Evaluating this type of system should not focus only on whether it can generate output. Measure it on four dimensions:
- Accuracy: How closely the generated result matches the user’s intent. This can be measured with a manually labeled test set.
- Executability: The proportion of generated scripts that run successfully.
- Modification cost: The number of operation steps or the time required to complete the same task, compared with manual operation.
- Traceability: Whether each result can be traced back to the original instruction and the execution log.
Evaluation should use a fixed test set, and the model version and parameter settings should be recorded so the results can be reproduced.
8. Common Risks and Mitigations
- Hallucinated parameters: The model may invent parameter names that do not exist. Mitigate this with a whitelist constraint and type checking during parsing.
- Ambiguous input: For example, “make the hole a bit larger.” Mitigate this by setting default values and asking the user to confirm.
- Mixed units: Millimeters and inches used together. Mitigate this by requiring units in the input and converting everything to one internal unit.
- Over-automation: Users gradually lose understanding of their design results. Mitigate this by keeping preview and manual confirmation steps.
9. Summary
The value of LLMs in design software lies mainly in lowering the barrier to operation, reducing repetitive work, and speeding up parametric modification. Reliable deployment depends on combining a structured intermediate layer, a restricted instruction set, geometry validation, and permission control. Technical teams should start with pilot projects in small scenarios with clear boundaries and well-defined rules, then expand the scope gradually after accumulating test data.
