
This week, we’re starting off with OpenSCAD, a 3D modelling program that’s more like programming than drawing. A lot of useful 3D printable objects – including the parts for a lot of RepRaps – are designed in OpenSCAD, so hopefully by the end of this you’ll be able to design your own parts.
This isn’t meant to be a complete tutorial for OpenSCAD; I’m just demoing SCAD enough to build a simple part. Next week I’ll most likely be designing a part with AutoCAD, but if you have an idea of what software tools I should use as a tutorial to make a part, leave a note in the comments. Check out the 3D Printering guide to making a part with OpenSCAD below.
[h=4]First, some basics[/h]The basic idea behind OpenSCAD is constructive solid geometry this is a modeling technique that uses basic primitives such as a sphere, cube, or cylinder along with basic boolean operations to create an object. Using words to describe this technique is just terrible, so here’s a very, very short example. To the right is a pic of two objects created in OpenSCAD, a cube and a cylinder Below is the code, which you should be able to follow easily:
module example() { sphere(10); translate([15,15,-10]){ cylinder(h=20, r=5); }}example(); |
[TD="width: 178px"]

union(){ sphere(10); translate([0,0,-10]){ cylinder(h=20, r=5); } } |
[TD="width: 178px"]

difference(){ sphere(10); translate([0,0,-10]){ cylinder(h=20, r=5); } } |
[TD="width: 178px"]

intersection(){ sphere(10); translate([0,0,-10]){ cylinder(h=20, r=5); } } |
[TD="width: 178px"]

[h=4]Our Thing[/h]

module thing(){ difference(){ cylinder(h=7, r=19); cylinder(h=7, r=8); } translate([-23,10,0]){ cube([46, 10, 7]); } translate([-10,-26,0]){ cube([20, 16, 7]); } translate([-10,-26,7]){ cube([20,4,7]); }}thing(); |
[TD="width: 250px"]

module flange() { rotate([270,0,180]){ translate([-10,6,-4]){ difference(){ union(){ cube([20,12,4]); translate([10,0,0]){ cylinder(h=4, r=10); } } translate([10,0,0]){ cylinder(h=4,r=3.5); rotate([0,0,90]){ cylinder(h=3, r=7); } } } } }}Because OpenSCAD is basically just code, we can simply call this module at the relevant space in the code. You can see this in the finalized code a few scrolls down. Right now our part looks like this:

module thing(){ difference(){ cylinder(h=7, r=19); cylinder(h=7, r=8); rotate([0,0,225]){ translate([0,1.5,0]){ cube([20,3,7]); } } } translate([-23,10,0]){ cube([46, 10, 7]); } translate([-10,-26,0]){ cube([20, 10, 7]); } translate([0,-26,24]){ flange(); }}module flange() { rotate([270,0,180]){ translate([-10,6,-4]){ difference(){ union(){ cube([20,12,4]); translate([10,0,0]){ cylinder(h=4, r=10); } } translate([10,0,0]){ cylinder(h=4,r=3.5); rotate([0,0,90]){ cylinder(h=3, r=7); } } } } }}thing();

So there you go. A thing, created with OpenSCAD. Is this the definitive guide to designing stuff with OpenSCAD? No, but it’s more than enough to get your feet wet. It’s enough so you can design your own parts and send them over to a 3D printer. Next week, I’ll be making the same part in AutoCAD, which should translate well to other CAD packages. If you have any desire to see this part made with another 3D design package, leave a note in the comments.
Filed under: 3d Printer hacks, Hackaday Columns
