Blog · · 4 min read
CAD as code: why AI writes the 3D model instead of drawing it
Why an AI that builds hardware should write parametric CAD scripts instead of clicking in a CAD window, what that gives you (exact dimensions, versions, STEP files) and where it still struggles.
When people imagine an AI designing a physical product, they often picture it "drawing" a part, the way an image generator paints a picture. That is not how useful mechanical design works, and it is not how we do it on makemachine.ai. Our approach is simpler and a little old-fashioned: the AI writes the model as code.
This article explains what "CAD as code" means, why it fits language models so well, and where its limits are.
What CAD as code is
In a classic CAD program you sketch a rectangle, click "extrude", pick an edge and add a fillet. The result is stored as a history of mouse operations inside a proprietary file.
In code-based CAD, the same part is a short script that describes the solids. Behind it sits a boundary-representation (B-rep) geometry kernel, the same kind of kernel that engineering CAD tools use. That means real solids with exact faces and edges, not a mesh of triangles, and export to STEP, the format every serious CAD system and machine shop understands.
A bracket might look like this in spirit:
- a base plate of 80 × 40 × 4 mm,
- two holes of 5.5 mm for M5 screws, 60 mm apart,
- a vertical wall with a 3 mm fillet where it meets the plate.
Change "4 mm" to "5 mm" and run the script again: you get a new, consistent part. That is parametric design without a GUI.
Why it suits language models
Language models are good at reading and writing structured text. They are poor at precise mouse work and have no reliable sense of "a bit more to the left". CAD as code turns mechanical design into exactly the kind of task they handle well:
- Dimensions are explicit. A wall is 3 mm because the script says 3, not because a cursor stopped somewhere.
- Intent is readable. Names like
screw_spacingorwall_thicknessexplain why a number exists. A reviewer, human or AI, can check the reasoning, not just the shape. - Every version is a diff. You can see exactly what changed between version 1.2 and 1.3 of a part. Nothing is hidden in a binary file.
- Checks can be automated. The same script can compute volume, mass, bounding box or the gap between two parts and fail loudly if a rule is broken.
- Outputs are standard. STEP for engineering, STL or 3MF for 3D printing, rendered images for the presentation, all from one source.
On makemachine.ai this means the mechanical CAD module produces a script, the model, renders and a short report, and the next module (for example a strength check or a parts list) can read the same numbers instead of guessing them from a picture.
What it looks like in practice
You can follow this on our public projects. The BBQ Modular Grill went from concept to a mechanical model with legs, shelf, lid and handles; the Jump & Run Robot and Go FANUC Go show how a model grows over several versions. Each version is a new run of code, so you can compare them side by side.
A typical loop looks like this:
- Read the concept and the requirements (size, load, materials, how it will be made).
- Write the model as code, part by part, with named parameters.
- Render it from several angles and look at the pictures critically: does the lid clear the handle, do the legs reach the floor, is anything floating?
- Fix, re-run, and only then export the files.
Step 3 matters. A script that runs without errors is not yet a good design.
Where it struggles
CAD as code is not magic, and pretending otherwise would be dishonest.
- Organic and styled shapes are hard. Smooth consumer-product surfaces, ergonomic grips or car-body curves are much easier to shape by hand in a surface modeller than to describe in code.
- Spatial mistakes still happen. A model can place a hole on the wrong face or let two parts overlap. Renders, section views and automated interference checks catch most of this, but a human review before manufacturing is still essential.
- Geometry kernels have opinions. Fillets that are too large, very thin walls or tangent faces can make the kernel fail. Good scripts build in steps and test each one.
- Code is not a drawing. Workshops often want 2D drawings with tolerances. These can be generated, but they need care and a clear idea of which dimensions really matter.
- Physics is a separate question. A beautiful model can still be too weak. That is what simulation and real tests are for.
Why we think it is the right default
The goal of makemachine.ai is to take an idea all the way to something you can build: concept, research, CAD, electronics, simulation, sourcing and a presentation. For that chain to work, each step has to hand clean, checkable data to the next one. A parametric script is exactly that kind of hand-over. It is precise, it can be reviewed, it can be changed in seconds, and it produces files that existing tools and manufacturers already accept.
The interesting work is still in the judgement: which constraints matter, what can be bought instead of designed, what is safe to print and what needs metal. Code-based CAD does not replace that judgement. It makes it visible.
If you want to see the process live, open the projects on makemachine.ai, follow one that interests you and watch the next version appear.
Watch hardware get built by AI. Follow public projects on makemachine.ai, read every result in full and get an email when there is something new.
More from the blog
- Will my electronics enclosure overheat? A five-minute heat estimate for a sealed box
- Joining 3D printed parts: screws, heat-set inserts, snap fits or glue?
- Free or paid AI 3D modeling? What you really pay for, and a 30-minute test to compare tools
Open-hardware projects built with AI
- DIY Automatic Plant Watering System: An open-hardware watering system for indoor plants: a small pump, a refillable tank and a soil moisture sensor in each pot keep up to six…
- DIY BBQ Temperature Controller: A temperature controller for charcoal grills and smokers that makers can build themselves. A pit probe, two meat probes and a small fan on…
- ZählerSchau: ZählerSchau is a small, battery-powered unit that clips onto an electricity meter in Germany (water meters via a clamp adapter), takes a…
- Roadstoy: Roadstoy is a remote-controlled toy version of the new Tesla Roadster that can briefly jump and flip using compressed air. It drives on an…
- The forever Washing machine: The forever washing machine is a washing machine offered as a service instead of a product. Customers do not buy the machine but pay for…
- Bike Light: I want to build a bike light that needs no battery. Magnets sit in the spokes close to the hub, and a coil on the fork picks up their…
- Rooficle: I want to develop a light, efficient and affordable e-bike that can be used legally on public roads in Singapore. Its core is an…
- BBQ Modular Grill: I want to design a modular grill. Instead of one sealed block, it is made of separate parts that can each be bought on their own online…
- Go FANUC Go: A mobile base that moves an existing FANUC M-710iC industrial robot (about 560 kg, with a milling spindle at the wrist) out of a room and…
- Jump & Run Robot: I want to build a small, low-cost toy humanoid robot that people can put together themselves. It should be about 30 cm tall, or as small…