Once you’ve washed these pounds of newly acquired Lego bricks, sorting them is in order. If you’re sorting by shape, one simple method is to use sieves. The main issue with that is finding the right sieve, Lego pieces are precisely calibrated and a sieve that’s slightly off will keep a lot of pieces together. Same if the holes are square rather than round, the pieces won’t separate properly.

Thanks to the development of 3D printing, you don’t need to hunt the store to find the sieve with the exact size. You can design the sieve with the desired hole size and 3D print it yourself. 3D design can be time consuming, but thankfully for something like a sieve, a lot can be automated.

By combining OpenSCAD and SolidPython, a few lines of code can quickly generate a reasonable sieve. Best, it just take one number change to generate a sieve with slightly bigger or smaller holes.

Here is the full python code used to generate this file (also available on github):

import math from solid import * from solid.utils import * # General parameter of the sieves (mm) # holes diameter hole_diam = 18 # distance between holes sep = 1.25 # other parameters that will probably not change output_file = 'sieve_%d.scad' % hole_diam box_size = 190 box_thickness = 5 box_height = 40 # hole radius hr = hole_diam / 2. # hole spacing x hspx = hole_diam * sep # hole spacing y hspy = hole_diam * sep * sqrt(3.)/2. base = difference()( translate([-box_size/2. + box_thickness, -box_size/2. + box_thickness, -box_height/2.])( minkowski()( cube([box_size-2.*box_thickness, box_size-2.*box_thickness, box_height/2.]), cylinder(r=5, h=box_height/2.))), translate([0, 0, box_thickness])( cube([box_size - 2. * box_thickness, box_size - 2. * box_thickness, box_height], center=True) ) ) # sieve pile up cw = box_size/2. - box_thickness*3/4. bottom_guides = (translate([cw, cw,-box_height/2.])(sphere(2.)) + translate([cw, -cw,-box_height/2.])(sphere(2.)) + translate([-cw, cw,-box_height/2.])(sphere(2.)) + translate([-cw, -cw,-box_height/2.])(sphere(2.))) top_guides = (translate([cw, cw, box_height/2.])(sphere(1.5)) + translate([cw, -cw, box_height/2.])(sphere(1.5)) + translate([-cw, cw, box_height/2.])(sphere(1.5)) + translate([-cw, -cw, box_height/2.])(sphere(1.5))) # odd lines holes x_range = int(math.floor((box_size / 2. - box_thickness - hr) / hspx)) y_range = int(math.floor((box_size / 2. - box_thickness - hr) / hspy / 2.)) l =[] for i in range(-x_range, x_range + 1): for j in range(-y_range, y_range + 1): l.append(translate([i*hspx, j*hspy*2., 0])( cylinder(r=hr, h=100, center=True)) ) # even lines holes x_range = int(math.floor((box_size / 2. - box_thickness) / hspx)) y_range = int(math.floor((box_size / 2. - box_thickness) / hspy / 2.)) l2 = [] for i in range(-x_range, x_range): for j in range(-y_range, y_range): l2.append(translate([(i + 1/2.)*hspx, (2.*j + 1)*hspy, 0])( cylinder(r=hr, h=100, center=True)) ) d = base - l - l2 - bottom_guides + top_guides scad_render_to_file(d, output_file)

And here is the stl file: http://www.thingiverse.com/thing:1396351

So far, I’ve used a combination of 3 sieves: 18 mm, 14 mm and 10 mm. The process is pretty simple (and quite fast). Start with the biggest sieve, put the pieces in, shake to separate into 2 groups (above and below). Once you’re done, take the *below* group and put it through the process for the smaller sieve. You can also pile up the sieves (smallest at the bottom) to do everything in one pass.

Here is an example of how the brick get separated:

**Below 18mm, above 14mm:**the 2×2 bricks don’t go through the 18 mm, but the 2×2 plates will. We’ll get most of the 2×1 bricks here as well.**Below 14mm, above 10mm:**A lot of the 3×2 plates, the cheese slopes are just slightly too big to go through the 10 mm holes and will stay there.**Below 10mm:**the 1×1 plates (round and square), the 1×1 bricks (only the round one and a lot of technic pins.

Of course, the process in not 100 percent accurate: for example it’s possible for a long technic axle to go all the way down if it comes up in the right position. But in practice, it does work well: in the 10 mm group, it’s mostly axle-3 and some axle-4.