‹ Back to the archive
April 2025

Lego Piece

A CAD-modeled Lego brick, a lesson in finding the right Onshape tool for the job.

cadonshapeparametriclinear-pattern
Hero image for Lego Piece

// Challenges

The studs and the hollow shell looked tricky up front. The studs because they had to be perfectly spaced. The hollow inside because I wasn't sure how to carve it out cleanly.

// Skills Used

Onshape Linear pattern tool Shell tool Parametric modeling

// Outcome

An accurate CAD Lego brick. The bigger takeaway. Once you know the right Onshape tool (linear pattern for the studs, shell for the inside), hard-looking problems become simple.

Brief

Model a Lego brick in Onshape with the correct number of studs, accurate proportions, and the hollow internal cavity that real Lego pieces have. The brick had to be dimensionally accurate enough that it could in theory be 3D printed and snap onto a real Lego piece.

Process

I started by trying to do it the hard way. I extruded the rectangular base, then tried to add each stud individually as a separate extrusion. After about three studs I knew this was going to be slow and that any spacing mistake would cascade through the rest.

The right move was the linear pattern tool. Model one stud correctly with proper diameter and height. Use linear pattern to clone it in a grid across the top of the brick with exact spacing. Five seconds of setup, perfect spacing every time.

The hollow interior was the second puzzle. I thought I would have to model the internal cavity manually with another extrusion-cut, carefully matching the wall thickness all the way around. Then I found the shell tool. Select the bottom face of the solid brick, set a wall thickness, and Onshape carves out everything inside that thickness, leaving the hollow interior with the small internal tubes that real Lego bricks have. Two clicks instead of half an hour of cut geometry.

The whole brick took maybe twenty minutes once I knew which tools to use. The first attempt would have taken hours.

Skills Built

  • Tool literacy in Onshape. Knowing that linear pattern, shell, mirror, and circular pattern exist is half the battle. The other half is recognizing the moment when a manual approach should give way to one of them.
  • Pattern-recognition for CAD. Repeated features are a signal. The right answer is almost always a pattern operation, not duplication.
  • Parametric thinking. Stud spacing, wall thickness, and overall brick dimensions all reference shared parameters, so changing the brick size keeps the studs proportionally correct.
  • Estimating before starting. Five minutes thinking about which tools to use saves an hour of redoing geometry the slow way.

What I would do differently

I would build a small parametric Lego library. One file with a master “stud” sketch, a master “wall thickness” parameter, and a few preset brick sizes (2x2, 2x4, 1x6). That way every future Lego-related project starts with the geometry already done.