← Projects

CADForge: an RL environment for manufacture-ready 3D

What if you could someday vibe-code an entire spaceship, or maybe a robot?

A flanged bearing housing, built the way a CADForge agent builds it: a sketch, then one line of CadQuery per feature. Every step is a real solid from the OpenCASCADE kernel, so the whole history can be rewound and replayed exactly.

AI has gotten remarkably good at generating images, writing code, and even producing 3D models from text descriptions. But there's a catch: most AI-generated 3D content is designed for games and movies, not factories. Ask a text-to-3D model for a "flanged bearing housing with six M8 bolt holes on a 75 mm bolt circle" and you'll get something that looks like a bearing housing. You can't machine it. You can't 3D-print it to spec. You can't load it into Fusion 360 and change a single dimension.

Real engineering needs parametric, deterministic geometry, where every dimension is exact, every feature is intentional, and running the same design twice produces an identical part down to the micron. That's why manufacturing runs on CAD formats like STEP, not meshes and point clouds.

CADForge is our attempt to bridge that gap. It's a reinforcement learning environment on OpenEnv where agents learn to write real CAD code: CadQuery Python scripts that run on the industry-standard OpenCASCADE kernel. The output isn't a pretty mesh. It's a STEP file that can go straight to a CNC machine.

Why code-based 3D matters

Text- and image-to-3D methods are incredible for creative, artistic content, but they can't produce what engineers need:

Text/image-to-3DCode-based CAD (CADForge)
Output formatTriangle mesh (STL/OBJ)STEP file (exact B-Rep surfaces)
Dimensional precisionApproximate, no guaranteed tolerancesExact: every dimension is a number in code
Parametric editingRegenerate from scratch to change one dimensionChange one number, re-run the script
CAD tool interopMust reverse-engineer into Fusion 360, SolidWorksNative STEP import into any CAD/CAM tool
CNC / injection mouldingRequires mesh-to-CAD conversion (lossy)Direct: STEP is the industry interchange format
DeterministicStochastic generation, varies with seedSame code always produces the same part

The insight is simple: the things that make code-based CAD hard for humans (verbose, API-heavy, easy to get geometry wrong) make it an ideal training ground for AI. The task is well defined, the output is verifiable, and the reward is dense and deterministic.

How an episode works

1. The agent gets a task. A detailed natural-language description of a mechanical part, every dimension in millimetres:

Create a circular disc flange 100 millimetres in outer diameter and 15 millimetres thick. Drill a central through-hole 25 millimetres in diameter. Then drill 6 bolt holes, each 8 millimetres in diameter, on a bolt circle of 75 millimetres, equally spaced at 60° intervals.

2. The agent has tools. At each step it picks one action:

3. The agent sees what it built. Not an image, but a structured report:

Volume:              16,000 mm³
Bounding box:        80 × 40 × 5 mm
Faces:               6 (all PLANE)
Euler characteristic: 2 (simple solid, no holes)
Shape class:         FLAT_SOLID

That's enough to reason: "I was supposed to make a 100 mm disc with seven holes, but I made a flat 80 mm plate with none. My face types should include CYLINDER, and my Euler characteristic should be much lower."

4. The agent iterates. Execute, observe, diagnose, read docs, rewrite, execute again. The episode reward is the best score achieved, so the agent is never punished for trying and failing.

The grey bearing housing with a quarter cut away. The cut faces, in pale coral, show the stepped bore with its 47 mm bearing seat, a counterbored bolt hole through the flange, and a rib with filleted edges.
Cut open: the bearing seat, the through bore and a counterbored M8 hole. Get one of them a fraction of a millimetre wrong and the reward drops.

The reward: no vibes, just geometry

Rewards are fully deterministic and computed from pure geometry, which puts CADForge in the same tractability class as code generation and maths, where reinforcement learning with verifiable rewards (RLVR) has shown the most promise. There are three parts:

The tasks: from plates to bolt flanges

CADForge ships with 70 tasks across five difficulty levels:

# Task 19: bolt-pattern flange
import cadquery as cq
import math

result = (
    cq.Workplane("XY")
    .circle(50).extrude(15)
    .faces(">Z").hole(25)
    .faces(">Z")
    .pushPoints([(37.5 * math.cos(math.radians(a)), 37.5 * math.sin(math.radians(a)))
                 for a in range(90, 450, 60)])
    .hole(8)
)

Why RLVR works here

Only a handful of domains allow reinforcement learning with verifiable rewards without an LLM judge or learned value model: code generation (run the tests), mathematical reasoning (compare the answer), and 3D mechanical CAD (compare the geometry). Because the reward comes from deterministic geometry, there's no reward hacking against a judge, training runs are reproducible, evaluation takes seconds, and the decomposed reward tells the agent what is wrong, not just how wrong.

Seven grey solids in a row, the bearing housing from a plain disc to the finished part. In each one the feature added at that step is coral: the disc, the boss, the bore, six holes, counterbores, six ribs, then fillets and chamfers.
The housing's whole history, one solid per step of code. Every intermediate is a valid shape, so the reward can score any attempt along the way, not just the last one.

What's next

CADForge is open source on GitHub and runs on OpenEnv. New tasks, reward signals, training results or feedback are all welcome.