Skip to content
ettc
All articles

Code2Form: design a 3D part as code, and hand it to an agent

We are publishing Code2Form, open source parametric 3D modelling software. The part is written in a few lines, the 3D view follows as you type, and an AI agent can render it, look at it and export it. What it does, a complete example, and its limits.

· 7 min read

This article is for design offices, workshops and SME technical teams that design functional parts (enclosures, brackets, jigs) and 3D print them, and for developers who want an AI agent to produce something other than code. It is not for those looking for a free-form modeller: Code2Form describes parts by their dimensions.

Short answer: Code2Form describes a part as a short program. Dimensions are variables, shapes are combined by union, difference and intersection, and the 3D view updates 400 ms after the last keystroke. It opens existing .scad files, exports STL, 3MF, SVG and DXF, checks electronic wiring before soldering, and ships an MCP server for AI agents. It is written in Rust, under the MIT or Apache 2.0 license. The code is on GitHub.

Why would a data and AI consultancy publish CAD software? Because it carries the three requirements of our engagements onto other ground: a format you can read and version, an automatic check before the costly action (here, printing or soldering), and a tool an agent can use without anyone describing the screen to it.

The part is a program

A classic CAD tool records a sequence of clicks. Code2Form records a text: a 60 × 40 × 20 mm cube, a cylinder subtracted to drill a hole, a variable "wall = 2" reused wherever thickness matters. Change the variable, and the whole part follows.

Three practical consequences. A variant means changing a number, not redrawing. The file can be compared from one version to the next and kept in Git, with a history that says what changed. And parameters declared in comments become sliders, dropdowns and checkboxes in the app, with presets saved next to the part: someone who does not read code can produce their own variant.

Code2Form opens .scad files as they are, a common format for this kind of design. Its compatibility is checked against the reference implementation (release 2021.01) on the 86 examples and libraries it ships: the same syntax tree, the same CSG tree, the same output, and the same volumes on every exportable model but one. These results are frozen in the repository's tests and checked again on every change.

Boolean operations go through Manifold, a robust geometry library, and STL and 3MF exports are checked with PrusaSlicer's own loader. The pause(z, message) function adds a print pause at a given height, to drop a magnet or a nut into a cavity before it closes; the 3MF carries it to PrusaSlicer, and the layer view lets you move it with the mouse.

An example: the plate that follows its circuit

The repository holds a complete example, Grogu: a XIAO ESP32-S3 board that listens (an INMP441 microphone), speaks (a MAX98357A amplifier and a speaker), moves (a DRV8833 driver and a motor) and feels a touch (a copper plate).

Each component is a .c2f file that draws it, with its pins, mount holes and ports declared in comments, at their position in millimetres. A circuit file (.c2fc) places the components and wires their pins: 23 wires, laid in order, power first.

Before soldering, Code2Form checks the wiring: a supply above what a pin accepts, two supplies tied together or to ground, a supply or ground left open, a do-not-connect pin that is connected. In the example, the 5 V rail feeds the amplifier and the motor driver, and the microphone alone takes 3.3 V: a mistake there is flagged before the soldering iron, not after.

The printed plate that carries it all repeats no dimension: it names its circuit and takes its standoffs, holes and openings from it (the USB-C port, the speaker grille, the microphone hole). Move a board in the circuit, and the plate follows. The app then shows the components and their wires in colour, and an assembly mode walks through the wires one by one, keeping track of progress.

What an agent can do with it

This is the part that interests us most. The c2f mcp command exposes Code2Form as an MCP (Model Context Protocol) server, the protocol that lets an agent such as Claude Code use a tool. One line adds it: claude mcp add code2form -- c2f mcp.

The agent does not drive the open app: it works on files. It renders a part and gets back either the error with its line and column, or the volume and bounding box. It lists the parameters, gets a PNG picture from the angle it chooses, exports STL, 3MF, SVG or DXF. On the electronics side, it lists the library's components, reads their pins, checks a circuit, and gets a picture of it, the wiring list and the bill of materials.

The picture matters more than it seems. As we wrote in our Claude Code best practices, an agent that can check its work fixes its mistakes before showing them to you. A render without errors does not tell you a hole is on the right side; a picture does. For the circuit, the check is even sharper: check_circuit says whether the build is fit to solder, and the agent keeps fixing until it is.

The decision stays human. The agent proposes a checked circuit and a wiring list; a person opens the file in the app, looks at it in 3D, starts the print and solders. It is the rule from our other articles: the agent prepares, the check is automatic, and the costly action stays with a person.

What to know before installing it

Version 0.3 downloads for macOS 11 and later: one app for both Apple silicon and Intel Macs, and the c2f command line separately. The app is not notarized by Apple yet: on first launch macOS blocks it, and you allow it once in System Settings, Privacy & Security. On Windows and Linux, it builds from source with Rust 1.85 or later; the tests run on all three systems.

Known differences are documented: one projection() case that keeps open holes the reference implementation fills (0.3% of the volume on the example concerned), some fonts at large sizes that differ by a fraction of a percent, and edge cases with NaN and infinite values. A component's pins are fixed numbers that do not follow its parameters yet, and some library dimensions are estimated, which each file states.

It is young software: the first public release is dated 21 October 2026. For a part going into production, keep your usual checks. For a prototype, a jig or a demonstrator's enclosure, it is exactly on its ground.

Sources, consulted on 22 October 2026

Code2Form, repository and documentation: README, electronics guide, Grogu example. Source code, electronics guide.

Code2Form 0.3.0, release notes of 22 October 2026: downloads, notarization, known limitations. Release notes.

Model Context Protocol, official documentation. modelcontextprotocol.io.

In one sentence

Code2Form treats a 3D part like code: a text you can read, a variant that is one changed number away, and an automatic check before printing or soldering.

Its MCP server makes it a tool an agent can use end to end, looking at what it produces. That is what we look for in any tool handed to an agent: a readable format, an executable check, and a person at the moment that matters.

An internal tool an agent should be able to drive?

A spreadsheet copied by hand, business software without an API, a check done by eye: in thirty minutes we look at whether a readable format and an automatic check are enough, or whether an agent really has its place.