How To: Make A Printable CES Badge

We figured we put you through enough posts about our CES badges without telling you how we did it or how to get one. This how-to will walk through the process of creating a badge from a dxf file for a logo. Then we will tell you where to get one.

To start with, you will need a 2D cad program, we used QCad. Later you will need OpenSCAD. Now, grab a dxf of a logo of your choice. Here, try our logo (R12-type dxf) so you can follow along. Open the logo dxf file in QCad.

You should now see your logo in QCad. This is nice and pretty and all, but it is not quite going to work with OpenSCAD. You are going to need to have separate layers for the separate parts. We had a layer for skull outline, face features, and a layer for each of the wrenches. Besides separate layers for separate parts, we are going to need to make sure there are no three spline points in a row as OpenSCAD will not be able to give you an stl. Plus, in this case, the wrenches won’t even touch the skull. Time to make some splines.

If you find this next part too complicated now, you can skip ahead, but when you go to “Compile and Render” in OpenSCAD, and it reads that your object is not simple, you will not be able export an STL because you get the error “Object isn’t a single polyhedron or otherwise invalid! Modify your design..” you will have to come back to here to fix your splines. Turn off all layers except for the one you want to touch up. Make a new layer to replace the old layer. Name the new one new_foo or rename the old one to old_foo. However you do it, keep it clear and this will be much easier. Now, highlight the old layer, you should see the points used to create the splines. Set your snap to endpoints (Snap -> Endpoints) and start drawing a spline (Draw -> Spline -> Spline). Pay attention to the cursor information in the lower left of the window. If you have three spline points along a line, OpenSCAD will not like it, so you will have to alter your spline slightly by skipping the middle of the three points. How do you know if you have three spline points along a line? Well, for the most common case in grid-drawn splines, it is when the x or y coordinate does not change for three points in a row (ie a spline with points: {(1,1), (2,1), (5,1)}, the y-coordinate does not change). Straight lines may also have a problem, but there is not much of a reason to make straight lines out of many straight lines.

Each part of the logo with it’s own color for clarity. Save a copy of the dxf as an R12 dxf, OpenSCAD likes it better. Now, let’s make it three dimensional. Start OpenSCAD and have the OpenSCAD User Manual up in your favorite web browser. Here is the final code to get the whole thing working, copy and paste it into OpenSCAD:

logo_offset = [-104.281, -142, 0];
logo_scale = [0.65, 0.65, 1];

union()
{

	scale( v = logo_scale )
	{
		translate( logo_offset + [0, 0, -1])
		{

			dxf_linear_extrude(	file = "hack-a-day_logo-4-1.dxf",
						layer = "wrenches_a",
						height = 4,
						center = false,
						convexity = 10);
		}

		translate( logo_offset + [0, 0, -1])
		{
			dxf_linear_extrude(	file = "hack-a-day_logo-4-1.dxf",
						layer = "wrenches_b",
						height = 4,
						center = false,
						convexity = 10);

		}
	}

	intersection()
	{

		difference()
		{
			scale( v = logo_scale )
			{
				translate( logo_offset + [0, 0, -1] )
				{
					dxf_linear_extrude(	file = "hack-a-day_logo-4-1.dxf",
								layer = "skull",
								height = 25,
								center = false,
								convexity = 10);
				}
			}

			scale( v = logo_scale )
			{
				translate( logo_offset + [0, 0, 3] )
				{
					dxf_linear_extrude(	file = "hack-a-day_logo-4-1.dxf",
								layer = "face",
								height = 50,
								center = true,
								convexity = 10);
				}
			}		

			translate( v = [ 0, 0, 0 ] )
			{
				sphere( r = 15 );
			}	

		}
		translate( v = [ 0, 0, -10 ] )
		{
			sphere( r = 30 );
		}
	}
}

Hit F5 to do a compile and you should get a rendering of the Hack a Day logo in the upper right of OpenSCAD.

The logo_offset and logo_scale variables will center and scale the logo. The value for logo_offset depends on where the center of the logo is in the dxf file.

The union() will make all of the things in its brackets one thing.

The scale()s you see will scale the things inside their brackets by a certain factor based on the passed vector.

The translate()s move the things inside their brackets an amount determined by the passed vector.

dxf_linear_extrude() is like a play-dough factory, it extrudes a shape based on the passed information: dxf file, layer, and height. The center variable determines if the extrusion is centered at z = 0 ( center = true) or if extrusion starts at z = 0 (center = false). The convexity variable seems to look ugly at low numbers.

The intersection() makes a thing from two intersecting things inside its brackets.

The difference() takes the first thing in its brackets and removes the rest of the things in its brackets from the first thing.

Sphere() makes a sphere of the passed radius.

To help you visualize this process, disable all of the dxf_linear_extrude() and sphere() lines by putting an asterisk (‘*’) in front of them.

Remove the asterisks from the first two dxf_linear_extrude() and compile to have OpenSCAD union, scale, move, and extrude the wrench layers of the dxf. This should yield a pair of crossed wrenches:

Let’s add the skull outline by removing the asterisk from in front of the third dxf_linear_extrude() line and compile:

Replace the asterisk from in front of the fourth dxf_linear_extrude() line with a pound (‘#’) and compile.  This pound symbol will highlight the thing it is in front of in pink, helping you to see where it is and what it is doing since you normally do not see it because it is being removed from the skull.

Remove the pound symbol, compile, and you will see how the eyes and nose are formed by the removal of the dxf_linear_extrude() of the face layer from the dxf_linear_extrude() of the skull layer.

Replace the asterisk on the first sphere() line with a pound symbol and compile.

Depending on you viewing angle, you may not see the pink sphere appear within the skull. Click and hold on the image and move your pointer up. The object should now rotate with your pointer until you let go. Rotate it around to see the back of the skull.

This should help you see that the first sphere is still within the difference() and was thus removed from the skull extrusion. Remove the pound symbol from the first sphere() line and compile. Notice that neither the eyes and nose extrusion or the sphere() removed anything from the wrenches. This is because the wrenches are outside the difference(). It helps to keep things hollow as printing the object will use less material and you can do things like this:

Putting an LED inside the skull would have been difficult without making the skull hollow. Plus, where would the brain go?

The way it is now with a flat face is okay, but it would be better if the skull had a more rounded appearance. Remove the asterisk from the last sphere() line and compile.

The skull now has a rounded face. Inside the intersection(), we created the difference() that created the skull with the flat face and a sphere. You can see the sphere by putting a pound symbol in front of it and compiling. The intersection() makes an object only where both of the parts are at. You can see this even better by putting a pound symbol in front of the difference() and the last sphere() line.

So, how can you get your hands on one of these things? We can think of a few ways to get one, but the best two would be to either make one or have one made for you.

If you have access to a 3D printer, you can make your own. We used a MakerBot CupCake CNC. The files to make your own badge are on Thingiverse.

If you do not know or do not want to associate with someone that has a 3D printer, you can have a badge made through Shapeways.

13 thoughts on “How To: Make A Printable CES Badge

  1. OpenSCAD… *shudder*. I guess I’m way more used to solid modeling, i.e. Pro/ENGINEER, SolidWorks, or Inventor. I just can’t get the hang of OpenSCAD, and I can’t do as much ridiculous stuff with it. Keep in mind, I am not a programmer, so that’s probably why I fail immensely at it.

    On a non-software-bashing note, what are the dimensions of the part? I’d like to make a part file for it, but OpenSCAD is dimensionless (it seems).

  2. @ Cole I feel the same way. I work all day with solid models and make .stls for rapid prototyping. on the thingverse website is a .dxf cad drawing (which is metric) i used that and brought it into SolidWorks and made a model from there. I hope i helped a bit.

    looking at the code above a bit it seems like
    the wrenches are 4mm tall
    skull= 25mm

  3. I don’t understand the complaints about this “not being a hack.” The title of the post says “How To,” also I found it rather interesting since I’ve never seen anything about OpenSCAD before..

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.