The Size of a Brick in Your Hand: Building Brickworks, a Browser CAD With Mechanism Physics
Brickworks is a free CAD that runs in the browser, converted from the LDraw parts library onto an exact 2 LDU lattice. An AI designer proposes placements and a deterministic validator disposes of them, and a mechanism solver turns gear trains at the ratios their tooth counts give. The hard parts are the things the library never recorded and the numbers nobody has measured.
Table of Contents
Eighty-four bricks that hold
The first thing Brickworks designed was a small lighthouse on a rocky base, on 19 September, and the transcript of that run is more interesting than the lighthouse. The model's first attempt was 45 bricks with 11 errors. It backed off to smaller test pieces, returned with 85 bricks and one error, and finished at 84 bricks in 14 distinct parts that hold: a white tower with red bands and a doorway, a grey gallery, a red cone, a yellow finial on a rock island. It took eight minutes and 220,000 input tokens. The model found none of those errors. A validator that knows nothing about lighthouses found them, and the check that earned its keep was the one every builder learns first: parts side by side are not joined. A wall built as stacked columns is several towers.
Brickworks is a CAD for LEGO® models that runs in a browser, a phone's included, with nothing to install, at brickworks.diy. It is built from the LDraw Parts Library, converted into 28,319 placeable parts at true size on an integer lattice, so a placement is exact and collision is integer comparison with no tolerance. A design assistant, running on whatever AI the person already uses, turns a sentence into a model without touching geometry. A mechanism solver turns gear trains, racks, worms, differentials and linkages as their parts allow, and weighs the model at every frame of the motion. The repository holds 7,752 commits between that lighthouse and 24 November. Read in order, they are a record of places where the obvious data did not exist and had to be derived, measured, or admitted to be unknown.
A plausible picture of a model is not a model
The premise is in the project's first real commit: a brick on screen is the size of a brick in your hand, so the foundation had to be measured rather than assumed. One LDraw unit is 0.4 mm, a stud pitch 8 mm, a brick 9.6 mm tall, read off the library's own 2 x 4 brick rather than looked up, with tests asserting them so a library update cannot move them quietly.
The reason it matters is the designer. Ask a language model for a model of anything and it returns a description or a picture, and the picture can hold a brick that could not be where it is drawn. What I wanted was a designer that produces buildable models rather than plausible pictures of them, inside a tool that says which brick is wrong and why. The bar I have set for it, repeated eleven times in the project's record and more than any other request, is a kit the LEGO Group might actually manufacture, with no ceiling on size.
The tools builders already use draw bricks well and check them little. By the project's own scorecard, Mecabricks, LeoCAD and LDCad have no collision checking and Studio makes it optional. When I asked for accurate physics simulations of gear mechanics, the research written up on 13 October found no tool for LEGO® models that simulated dynamics at all. The ones that moved mechanisms did driven kinematics. SR 3D Builder animated gear trains and differentials and was abandoned after its last release in 2014, and a request for gear-train inference in Mecabricks has gone unanswered since 2020. The geometry for something better sat in an open library under Creative Commons licences.
The trademark set constraints too. The repository's working name used the mark as a noun in an internet address and was renamed Brickworks on the first day, and the logo, a red brick with two studs, became a cube with one corner cut away, because the brick and its knobs belong to the LEGO Group.
The library draws bricks and records nothing about how they join
LDraw is a format for drawing. A renderer never needs to know that a stud fits a tube, so the library never says so, and an assembly tool cares about nothing else. The connectivity turned out to be recoverable exactly, because LDraw's authors do not model a stud as an anonymous cylinder; they reference the shared stud primitive. Walking each part's reference tree and noting every transform that lands on a known connector recovers the author's intent at full precision: 196,541 studs, 44,656 tubes, 8,679 pin holes and 1,319 axle holes. A connector's axis has to be rotated by the accumulated transform, or every sideways stud claims to point at the sky.
The underside is harder, because a tube is not a socket. It sits between four studs and grips them from outside, and the smallest parts have no tube at all: a 1 x 1 tile's walls do the gripping, which left 447 tiles declaring no connectivity while plainly accepting studs. Sockets are derived instead from a projection of the part's lowest layer with its enclosed voids filled, which returns the footprint rather than the ring of walls around it. That derivation matches the stud positions recovered from the primitives to the micron on every studded part tested, two methods sharing no code and agreeing, and an arch reports sockets under its legs and none under its span.
At 24 bytes a vertex the library came to 1.5 GB; quantized to a fixed step of a sixty-fourth of an LDraw unit, a vertex is 10 bytes, with a measured position error of 3 microns against a mould tolerance of a tenth of a millimetre. The web build carries 10.4 MB over the wire and fetches the rest of the library a part at a time, as someone places one.
The lattice is two units because bricks get turned over
Positions live on a lattice of 2 LDraw units, which looks needlessly fine until a part is turned on its side. A brick 24 units tall becomes 24 units wide, and 24 is not a multiple of the 20-unit stud pitch. Building with studs facing sideways is half of how modern sets are designed, so the cell has to divide 20, the 10 a jumper plate introduces, 24 and the plate's 8. Their greatest common divisor is 2. At 4, a 1 x 1 brick straddles a cell at each end and measures 1.4 studs across. What the lattice buys is that every later question is arithmetic. Positions are integers, a model saved today loads identically tomorrow, and picking the brick under the pointer marches a ray through the occupancy grid, returning the face it entered as well as the brick. On an M3 Max the renderer draws 200,000 bricks in 14 draw calls at 131 frames a second. The largest set the LEGO Group has ever sold is about 11,700 pieces.
The model proposes and the lattice disposes
The design assistant rests on one split, stated in the commit that introduced it: the design is the model's, the geometry is not. A language model is good at what a lighthouse looks like and bad at whether brick 214 clears brick 87, and a validator is the reverse, so neither is asked to do the other's job. The assistant proposes placements in studs and plates, never in LDraw units or matrices, because a plate is 8, a brick 24 and an even-width part centres on odd multiples of 10, each a chance to be half a plate out in a way that is invisible in text and obvious on screen. A deterministic validator resolves every placement against the real catalogue and the real lattice for overlap, support and connection, at about 2 ms a brick, and hands back the specific brick and the specific reason when something will not hold.
I have argued here that the rule for generated work is to never generate faster than you can verify. Brickworks builds that rule into its architecture. Generation is slow and probabilistic and the check is cheap and exact, so the model can propose as much as it likes and nothing reaches the baseplate unchecked. A castle with a gatehouse, four corner towers and a curtain wall came back as 2,438 parts that stand, in ten named assemblies. The same tools, about 80 of them, are served over MCP, so a person's own Claude or another assistant can build in an open tab on the person's own plan, and Brickworks bills nothing for it.
The validator answers to something larger than itself. Every set in LDraw's model repository holds together in reality, so every part the check calls floating in one is a gap in the connection data, not a fault in the set. An audit runs the checker over all of them, and its last recorded run held 93.97% of 678,214 part instances across 1,572 files, up from 70%. Real sets are the ground truth, and the rules are wrong wherever a real set disagrees.
Gears are the part of physics that can be exact
Mechanism simulation starts from the same refusal to guess. Kinematics comes first because it can be exact: gear teeth do not slip. The solver writes one linear equation per coupling and one unknown per joint, over the axles, pins and holes the conversion already recovered. A gear's pitch radius is 1.25 LDraw units per tooth, measured rather than assumed: 764 of 809 candidate gear pairs in the repository's real sets agree to 0.3 units or better. Read straight off the file of LEGO® set 8020, the windmill turns 9 to 1 from crank to sails. A differential's two sides sum to twice its casing's rate, Willis's relation, to two parts in ten million. Sets 42055 and 42082, with 140 and 135 gears, read in two seconds each. Every one of these checks was run against a solver broken on purpose and shown to fail.
The lattice bent the ratios at first. A 2-unit grid stands gears slightly off their pitch, and a worm 46 units from a 28-tooth turntable, where the spacing should be 45, read as turning it once in 28.8 turns rather than 28. Ratios now come from tooth counts, and when two gears stand off their spacing the tool says they would run loose or bind instead of quietly turning them.
The acceptance test was an orrery, a gear train whose arms give each planet its real period relative to the others. Every LEGO® gear's tooth count factors into primes no larger than 7, the 22-tooth bevel excepted, so most ratios can only be approached, and of a Mars year's best small fractions only 15/8 uses no prime a gear lacks. The tool therefore searches gear trains rather than fractions, met in the middle: six meshes take a quarter of a second, and a Mars year comes out at 2304/1225, a ten-thousandth of a percent out. Layout forced a ring of 140 teeth per planet, turned by a pinion standing inside it, because stacked hubs sweep their layshafts through each other's arms and nested carriers multiply each stage's error by up to 6.3.
A Claude Code session built it over MCP. Its first run, 55 minutes, found three things the checker got wrong: the quarter rings' collision covers were solid inside, a gear was read as the square around its teeth, and a 28 meshing an 8 on a diagonal cleared the 8's axle by 1.4 units, inside one lattice cell. The second run, 87 minutes, produced 494 parts with nothing locked or floating and every planet within 0.35% of the sidereal period NASA gives for it. Neptune's arm reaches 18 studs past the base. The balance check across the whole cycle put the centre of mass 15.4 studs inside the edge at its worst pose, so no counterweight was needed, and the tool said so.
Nobody has published how hard a stud holds
Statics is where exactness ends, because how hard a stud joint holds is not public. The app's first stability check called about a newton per stud the LEGO Group's own figure; the research behind its rewrite found no such published figure, and quotes the company's own book on its bricks saying the ideal strength's value must remain secret. A 2024 Carnegie Mellon model of brick stability puts clutch at 0.98 N per contact point, and Brickworks now sets where a stud lets go between what that study's built structures needed where they stood and where they came apart: 1.92 N into a part two studs wide or more, 3.07 N into one a stud wide. Until 9 November it used 3 N for both, which read a 20-level stair that came apart in reality as standing. Friction pins are worked from a builder's published test of 18 pins, a median of 1.04 N·cm. Click hinges, turntables and clips on bars have no published measurement, so the tool names what they carry and gives no number.
That is the rule I care about most in the project: say how sure you are, quantity by quantity. Kinematics is exact. Statics is honest to a factor of two to four, so the check reports margins, names its sources, and runs at every frame of a motion rather than only at rest, with the fix given as a number: a counterweight w placed L inside the edge such that w·L is at least m·d, for a mass m whose centre hangs d past it.
Dynamics came next, and the engine's own physics was a poor fit. Jolt, the physics engine built into Godot, is tuned for metres and caps angular velocity at 2,700 degrees a second, and Godot does not expose its gear constraints. The first slice of dynamics uses a solver of its own. A section let go on a free joint is a rigid body turning about that joint's line, a chain of them a multiple pendulum, stepped every millisecond by semi-implicit Euler so that a pendulum's energy cannot grow. A seven-hole beam on a frictionless pin, let go at 30 degrees, swung in 0.3768 seconds against 0.3762 from the elliptic integral. The friction coefficient for ABS on ABS is unpublished, so the number of swings before an arm hangs still is good to a factor of one and a half. The documentation draws the line itself: "it falls in a fifth of a second" is a fair claim, and "it swings 15 times before it hangs still" is not.
The rest of Simulate keeps the same discipline. It finds the first angle at which two moving parts meet, to a hundredth of a degree, and names them. It walks a linkage to where its loop closes no further, and weighs a motor's load by virtual work against published stall torques. A worm holds its gear, after an early version let a grabbed gear turn its worm backwards. Named motions, Open the dome or Extend the telescope, live in the model's file as meta lines that other LDraw tools ignore and carry through a round trip.
The validator was more lenient than the outside ruler
The most useful days were the ones that showed the project wrong. On 14 October the designer met BrickBench, an outside benchmark of AI designers for LEGO® models, on ten prompts. Its validity checker passed two of our ten builds: seven failed on collisions its colliders saw and ours forgave, one on pieces that fell. Our own judge, a Claude Opus 5.5 agent comparing our builds with the benchmark's published ones, preferred theirs in all 40 verdicts. Rerun that evening with the check made as strict as theirs, the designer passed nine of the ten. The validator had been certifying models a stricter ruler refused, and nothing inside the project could have said so. Five days earlier I had reported that the assistant did not work at all. It had worked: four answers came back in ninety seconds, announced by one line of small grey text that nobody would notice. No automated check had ever pressed the Build button.
Quality went the same way. A real set is about 10% pieces the size of a 2 x 4 brick, and every early castle was 39 to 56%, invisible in every picture until the renderer drew the seams between bricks. The test now is blunt. A held-out real set's name, theme, footprint and piece count go to the designer as a brief, and a judge that is not told which is which compares the design with the set, both drawn by the same renderer. On 44 subjects in mid-November the designs won 24% of verdicts, with an interval of 14 to 38. Real sets build 27% of their parts with studs not facing up and leave 12.8 open studs per hundred parts; the designs manage 4% and 38 to 40. Every lever since the twenty-first design round has decorated a studded body after the session built it. Winning means building in a set's vocabulary from the first part.
Simulate has its ruler too. Kinebrick, an open-source simulator, publishes 1,224 functions across 186 real sets, from steering racks to piston engines, with whether each one works. Simulate works 391 of them. Kinebrick's main branch worked 522 when the comparison ran, and its Studio 0.3.0, with gravity, friction and contact, works 701 of 1,226. On differentials Kinebrick works 35 of 78 and Simulate works 3.
Where it is going is mostly people
The current plan gives Brickworks two equal goals: the CAD, and a social site for LEGO® models built around it. By its own scorecard the CAD is ahead of six other tools in 78 of 98 cells as of 20 November. The site is the reverse. On 23 November it held 50 shared models, and 49 of them were Brickworks' own.
The next units follow from that gap. The studio's first screen becomes a person's own work and what came back on it. Each of the 1,576 set pages becomes a place to start, and where LDraw has modelled the set, Make your own version opens a credited copy and lists it on the set's page once published. The changelog already carries that, beside Ask the builders, where an answer pinned to a part lights that part in the studio. Suggested edits let a remixer send a change back to the designer, shown in 3D and taken whole or in part: a pull request for LEGO® models. The next design lever has to change what the session builds first, and the plan is to read it on a graded ladder made from each held-out set, from the set itself down to a naive stack of its outline, so that a design climbing one rung shows as progress.
Mechanism work sits further down the list, and I would rather say so. Pybricks programs driving Simulate rank eighteenth of twenty, and the next physics unit is parked. What the dynamics still lacks is written down plainly: gravity moving everything rather than one free section, friction measured rather than assumed, motor torque curves, and collisions between moving parts. The best sentence in the documentation is about statics: a small bench rig, a known arm, a known mass and a protractor, would pin down the joints nobody has measured, and is worth more than any model.
A lighthouse at each end
Two lighthouses bracket the project so far. The first was the 84 bricks of 19 September, designed by a model that got eleven things wrong on its first pass and was told so, brick by brick, by code that had never heard of a lighthouse. The second arrived on 23 November, the first model shared on the site by anyone outside the project: 1,320 parts, made with the assistant, every brick placed on the same lattice and judged by the same rules as the first. Any picture can look like a lighthouse. The model proposes, and the lattice, which has never heard of one, has the last word.
LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this site. LEGO® Art, Technic, the Minifigure and the Brick and Knob configurations are also trademarks of the LEGO Group.