## Wednesday, December 07, 2016

### Lasercut LEGO bricks, attempt 1 successful.

I started with a quick hack to an OpenSCAD lego block generator script to create just the top pins for a lego block.

Next export this as an SVG, so there is no loss of resolution.  I found that exporting it as a bitmap just gave the nice screen shot below, totally useless for producing viable part with.

```// John Sokol - 12/5/2016 Adapted from:
// Quick-and-dirty parametric LEGO-compatible
// LEGO(R) is a trademark of the LEGO Group.
// References:
// * http://www.robertcailliau.eu/Lego/Dimensions/zMeasurements-en.xhtml
// * http://nicjasno.com/forum/viewtopic.php?t=653

// Create (w*2,h*2) LEGO-compatible blocks.

projection()
two_by_two(4,4);

module two_by_two(w,l){

DETAIL_SCALE=0.1;
WALL_THICKNESS=16;
SQUARE_WIDTH=80;
SQUARE_HEIGHT=96;
PLATE_HEIGHT=32;
PEG_HEIGHT=18;

my_height = PLATE_HEIGHT;

scale(DETAIL_SCALE){

for(j=[0:l-1]){
for(x=[SQUARE_WIDTH*0.5,SQUARE_WIDTH*1.5]) {
for(y=[SQUARE_WIDTH*0.5, SQUARE_WIDTH*1.5]) {
translate([(i * SQUARE_WIDTH * 2) + x, (j * SQUARE_WIDTH * 2) + y,my_height]){

}
}
}
}
}

}
}

```

Next I loaded the SVG in to Inkscape, and had to convince the program that is was 62 mm not 62 pixels.   This involved increasing the page size then having to work out some very odd multiplier to scale it 3.5433.   This was because it assume the 62 mm was pixels and wanted to render 17.49778 mm across. I needed to return the design to 62 mm.

From this I was able to generate a PNG , also in this page, but it renders solid white in this blog.

I then loaded this in to the laser cutting software RDWorks and was able to very easily create a good engraving setting to generate the part below.

This was cut on to white marker board that had medium-density fibreboard (MDF) as it's material.

One of the pins snapped off when I was trying to pry it up from the laser-cutter without disturbing the surrounding panel it was cut from.

Cut on Thunderlaser Nova51 at the Hackerdojo

The image here above was used to engrave this part.