Skip to content
ettc
All tools

Code2Form · Open source software

A 3D part written like code, and read like it.

Code2Form describes a part as a short program: dimensions are variables, shapes are combined, and the 3D view updates as you type. The file is versioned like code, a variant is one changed number away, and an AI agent can render the part, look at it and export it.

Version 0.3 · MIT or Apache 2.0 license · macOS, or built for Windows and Linux

What it does

  • An editor and a 3D view side by side: syntax highlighting, errors marked on their line, a render 400 ms after the last keystroke, one tab per file.
  • .scad files open as they are: the same syntax tree, CSG tree and output as the reference implementation on its 86 examples, checked again on every change.
  • A customizer: parameters declared in comments become sliders, dropdowns and checkboxes, with presets saved next to the part.
  • Exports for the workshop: STL and 3MF in millimetres, checked with PrusaSlicer's own loader, SVG and DXF for 2D parts.
  • Print pauses: pause(z, message) stops the print at a height to drop a magnet or a nut into a cavity; the layer view shows and moves them.
  • Electronics in 3D: annotated boards (pins, mount holes, ports), a circuit file that wires them, a check before soldering and an assembly mode, wire by wire.
  • An MCP server: an agent such as Claude Code writes a part, renders it, looks at a picture of it and exports it, and checks a circuit, with no window open.
  • A command line, c2f, for the same exports and checks in a script.

What it is for

A classic CAD tool records a sequence of clicks. Code2Form records a text: a 60 × 40 × 20 mm box, a 3 mm hole 5 mm from the edge, a 2 mm wall reused wherever thickness matters. For a wider version, change one value and the part follows. The file can be read, compared from one version to the next and kept in Git with the rest of the code.

This way of working suits functional parts: enclosures, brackets, jigs, mounting plates, series of parts with variants. For free-form shapes or sculpture, a classic modeller remains the better fit.

The details, with the example of a small robot whose mounting plate follows its circuit, are in the article that introduces it.

What to know

Version 0.3 downloads for macOS 11 and later, one app for both Apple silicon and Intel Macs. It 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.

Known differences from the reference implementation are documented in the repository: one projection() case on one example (0.3% of its volume), some fonts at large sizes, and edge cases with NaN and infinite values. A board's pins are fixed numbers that do not follow its parameters yet, and some library dimensions are estimated, which each file states.

The code is under the MIT or Apache 2.0 license, at your option. Feedback and contributions are welcome on GitHub.

Independent software, not affiliated with the publishers of the software whose formats it reads or writes.

An internal tool an agent should be able to drive?

Code2Form shows one way to do it: a text format you can read, an automatic check before the costly action, and an interface an AI agent can use without a screen. If one of your tools would gain from working this way, let's talk about the flow first.