Openscad Lego-Like brick

by jag, published

Openscad Lego-Like brick by jag Jan 21, 2011

Featured Thing!

12 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps



Openscad Lego-Like brick by jag is licensed under the Creative Commons - Attribution license.

Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

49166Views 5510Downloads


I don't know if this should be considered a derivative of http://www.thingiverse.com/thing:591 or not. It was inspired by it but I started from scratch because I wanted to do it in openscad.
You can adjust the size and tweak the dimensions of the various parts of the lego in the openscad file.
There are probably bugs, it's a work in progress.
A real lego snaps into the bottom pretty well, not as well on top.


The script defines a module called block(width,length,height,axle_hole,reinforcement)

The width and length defines how long and wide the block is (surprise!). They are defined as the number of knobs in that direction, not the actual length in mm.

The height is a multiple of the standard height of a brick.

The axle_hole variable adds holes to the top of the brick to fit standard lego axles through. They may only fit partway through unless your printer can handle really thin walls.

The reinforcement variable adds ribs across the brick to reinforce it (which also makes it print nicer because it gives the bot somewhere to traverse between the posts on the underside of the brick without leaving strings everywhere)

All Apps

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

3D Print a wide range of designs with Treatstock. Easy to use tools to get the perfect result. The global 3D printing network that connects you with high-quality and fast working print services nea...

App Info Launch App

how do I add a technic hole to the brick?

This 'lego' block really locks into place. Although you need to keep unlock/lock them pieces to make it more loose. Good thing for building!

This looks really interesting. I want to make bird feeders to promote wildlife in impoverished countries like Haiti. It would be great if they fit together in an array so folks can have many bird feeders on a single window. Thanks!

This is a nice effort but is no one having problems with these? I could not get good fit with real bricks and measured the STLs. The bottom/female side is not symmetrical. If I measure one side of a "chamber" it is 5.78 and when measuring the opposite chamber which should be an exact mirror of the first the corresponding side 5.44. A ~0.35 mm difference just can't work well here where friction fit is essential.

Not quite sure how that could happen, everything is constructed in openscad with rectangles, no polygons so all the walls should be parallel. What size brick were you making? Are you sure it isn't your printer?
Is the outside of the brick a uniform size?
It is a little tricky getting the fit right, it depends a lot on the calibration of your printer. LEGOs are extremely precise little pieces. It's pretty much impossible to get as good a fit with an FDM machine.

Yes I am sure. The error can be measured in the STL file, which means the error has nothing to do with the slicer or printer. If you open the STL in MeshLab and use the measure tool you can see the error clearly.The pockets vary in size.

It is also visible by the naked eye directly in OpenSCAD now when I am aware of the error. Make the brick 2x2, press F5 and view the bottom side with CTRL+5.

I see it now. I haven't printed these since I had a thing-o-matic which was somewhat less precise.
I misunderstood you. I thought you were saying the sides weren't parallel. It turns out the reinforcements on the bottom weren't quite spaced correctly. Hopefully they are correct now.

These are excellent! Any chance we can get support for slanted bricks?

Axel holes are only top surface thick. Won't keep the axle in alignment. If they were extruded through to the bottom or as deep as you can make them they would be stronger and give more stability.

I uploaded a new scad script.

I fixed a few bugs. This was one of my first openscad programs and it shows...

I didn't have a problem with the knob height, but I would recommend using $fs=0.1 to get nicer knobs (i.e. not hexagons). Maybe this will help with fitment. I can't wait to print all kinds of sizes. I played with the block sizes and the script seems very robust. Excellent job! Flattrd. :)

Thanks! I made the knobs more circular. I'm not sure if it will make much of a difference. It actually might make more of a difference on the bottom (that's where the hexagons seem to be more noticeable).

The knobs on the top don't change height with the change of the height parameter...

But otherwise a nice script.

fixed. I hadn't tested that yet. The script doesn't seem to work right now if you want to make a plate (height of .33). I'll have to look into that when I get a chance.