Tools for designing 3d-printed objects


Sensors often require an enclosure suited to its environment. After winning 3rd place in the Intel IoT competition in New York, I have been refining the design for an enclosure containing a processor, accelerometer and battery. 3d printing gives me the ability to test these designs.

Here, I’ll introduce tools I have used to design prototype enclosures. My interests are in developing objects from scratch so I’ll concentrate on drafting an object on computer aided design software. I also have a programming background so I’ll concentrate on scripting (as opposed to using graphical interface tools).

My prototypes were developed using OpenSCAD supplemented by free Netfabb. OpenSCAD allows programming of geometric solids using primatives such as cylinder and cube along with operators such as union and difference. All structures are built with code with different parts created in modules, which act like functions in a standard programming language. I create objects in OpenSCAD and save them as stl files for printing.

The code below creates a case to hold boards by Sparkfun with an enclosure, holes for 2mm screws, and handles for the entire assembly.

// 32.0 mm wide
// 45.0 mm long
// 21.5 mm height of stack

buffer = 4;

inWidth = 32 + buffer;
inLength = 45 + buffer;
inHeight = 21.5 + buffer;

wallWidth= 2;
wall = [wallWidth, wallWidth, 0];

baseWidth = 1.5;

handleHoleW = 10;
handleHoleL = inLength - 4;
handleHeight = 4;
handleWall = 3;
handleWidth = handleHoleW + handleWall;

baseTotalW = inWidth + 2*wallWidth + 2*handleWidth;
baseTotalL = inLength + 2*wallWidth;

handleHoleCenter = inWidth/2 + wallWidth + handleHoleW/2;

screwW = 27;
screwL = 41; // distance between screws

halfsW = screwW / 2;
halfsL = screwL / 2;

inDims = [inWidth, inLength, inHeight];

switchAccessL = 15;
switchAccessH = inHeight-5;

module base()
// base
difference() {
difference() {
cube([baseTotalW, baseTotalL,handleHeight], center=true);
translate([handleHoleCenter,0,0]) strapHole();
translate([-handleHoleCenter,0,0]) strapHole();
cube([inWidth, inLength, wallWidth]);

module baseWithScrewHoles ()
difference() {

module container()
// container
difference() {
difference() {
color("Pink",1)cube(inDims + 2*wall, center=true);

color("Blue", 1) translate([0,wallWidth,])
cube(inDims + [0,2*wallWidth,2*wallWidth],center=true);
cube([3*wallWidth,switchAccessL, switchAccessH],center=true);


module strapHole()
cube([handleHoleW,handleHoleL,2*handleHeight], center=true);

module basicCase()

module screwHole()
cylinder(5,1.25,1.25, center=true,$fn=30);

module screwHoleSet()

module TeamImpact()



All measurements are in millimeters. I made some allowances for the approximate nature of the translation into a physical object: an addition of .25 mm to the radius of the 2mm screw holes. Other aspects that need fine tuning based on your printer are supports and/or the ability of your printer to built overhanging layers of material.

In the code above I have elected to use ‘center=true’, but in other objects cases off-center are easier to transpose and rotate into position.


Netfabb is another open source program that has been useful. Both OpenSCAD and Netfabb have the capability of inputting an stl file for me to manipulate/cut/extract the object. Netfabb also has a tool for measuring the lengths, widths, and heights of parts of objects. I have found this very useful as I design the object in OpenSCAD and verify the dimensions using Netfabb.

I have printed my stl files on both Lutzbot and Makerbot printers and using both ABS and PLA filament. The Makerbot desktop has a handy tool for estimating print time to a first order accuracy.


…More as I print more objects.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: