In a recent posting called Liar’s 3D Printing, I showed you how you can print with multiple filament colors even if your printer only has one extruder and hot end. It isn’t easy, though, and a lot of models you’ll find on sites like Thingiverse are way too complicated to give good results. An object with 800 layers, each with two colors is going to take a lot of filament changes and only the most patient among us will tolerate that.
What that means is you are likely to want to make your own models. The question is, how? The answer is, of course, lots of different ways. I’m going to cover how I did the two models I showed last time using OpenSCAD (seen below). The software is actually really well suited for this hack, making it easy for me to create a framework of several models to represent the different colors.
About OpenSCAD
I’m not going to say much about OpenSCAD. It is less a CAD package and more a programming language that lets you create shapes. We’ve covered it before although it changes from time to time so you might be better off reading the official manual.
The general idea, though, is you use modules to create primitives. You can rotate them and translate them (that is, move them). You can also join them (union) and take the difference of them (difference). That last is especially important. For example, look at the callsign plate above. Forget the text for now. See the two holes? Here’s the OpenSCAD that creates that shape:
difference() { cube([basew,basel,basez]); // cut holes translate([4,basel/2,0]) cylinder(r=2,h=basez+2); translate([basew-4,basel/2,0]) cylinder(r=2,h= basez+2); }
The cube “call” creates the base. The cylinders are the holes and the difference “call” is what makes them holes instead of solid cylinders (the first thing is the solid and everything after is taken away). One key point: instead of numbers, the whole thing uses (mostly) variables. That means if you change the size of something, everything will adjust accordingly if you wrote the script well. Let’s look at applying these techniques for multiple colors.
Two Colors
To drive a printer with two extruders (or one you are lying about) you need to generate two different STL files, one for each extruder. That means that it is very likely one of them is going to be just “floating” in the air and that’s OK because, in reality, it will have the other color under it.
There are lots of ways you could accomplish this. I made a simplifying assumption: Your object will mainly be one color and then you’ll have one or more colors as part of the object. Then I wrote a simple framework consisting of several OpenSCAD modules.
In OpenSCAD, what you think of as functions are called modules. There are three modules in the framework you have to worry about: object_1, object_2, and object_3. Essentially, you put the OpenSCAD code in those modules that refer to each color you want. Here’s the code for the test box (I left object_3 empty):
module object_1() // first object, main color { cube([basew,basel,basez]); } module object_2() // 2nd objects { translate([basew/2,basel/2-5*dotr,basez-dothi/2]) cylinder(r=dotr,h=dothi,center=true); translate([basew/2,basel/2+5*dotr,basez-dothi/2]) cylinder(r=dotr,h=dothi,center=true); translate([basew/2,basel/2,basez/2]) rotate([0,90,0]) cylinder(r=dotr,h=basel,center=true); }
The first two cylinders are the top spots. They just translate up to the right spot. The third cylinder is rotated and appears in the middle of the box. Keep in mind that every layer that has a colored dot is going to take a filament change. Not a problem if you really have two extruders, but if you are lying, each tool change is some manual work as you pause and manually swap colors on your single head.
Getting the STLs
There is one more thing you have to change to get things to work. At the bottom of the framework file there are some lines that are mostly commented out:
// ******************************** // To generate, pick one of these and render (F6) // then if you picked one of the create_* you can // export to STL. No need to export the preview //preview_obj(); create_obj1(); //create_obj2(); //create_obj3();
Only one of these lines should be uncommented at any given time. When you are doing your design, leave preview_obj uncommented. This will let you see the entire object with different colors for each piece.
When you are ready to create the STL files, comment out the preview line and uncomment one of the create lines. Then render using F6 (the full render). When it completes, export the STL file and then replace the comment on the line and uncomment the next line. Then repeat the F6 render and the export. In this case, you don’t have to do object 3 because there’s nothing in it.
What Happens?
The rest of the framework is pretty simple. When you do the create on object 1, it draws your object and subtracts out all the places that should be another color. The other two create calls simply render the objects you specify. I’ve assumed that you won’t have any parts of color 2 and color 3 that intersect. If you did, you’d have to do something more complicated (that is, subtract out the third object from the second; it wouldn’t be that hard).
That’s it. If you can model in OpenSCAD you can create multiple extrusion models. If you lie, you can print them on a single extrusion printer, just like I did. I haven’t tried it, but you ought to be able to use the 2nd color to cut away overhangs, and the 3rd color to build custom support structures. Then you would simply not export the 2nd color and proceed as a normal two-color print.
Obviously, this isn’t the only way to do it. In fact, it isn’t even the only way to do it in OpenSCAD. But it is a handy way to make simple multicolor models that are suitable for use with the liar’s printing method. If you don’t want to install OpenSCAD you could try your browser or you might be able to do a similar thing with OpenJSCAD.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)