Most 3D printing projects start with a 3D model of some kind. Slicing programs transform the model into gcode. The gcode file contains the commands that actually drive your printer. There are different ways to slice a model and sometimes you want to use more than one on a single model. I’ve been working on a way to make that easier.
When you slice a 3D printing model, you can select different attributes for the resulting gcode file. For example, you might set the slicer to produce different infill density, temperatures, or print speeds. These settings can have a big impact on your printing results. For example, a piece that needs high strength might require a denser infill than some trinket or key chain. You might want an artistic piece to have a finer layer height than some internal part for some gadget no one will ever see.
One Size Fits All?
The problem is that for most open source slicers, these settings will apply to the entire model. Cura has some plugins that can change settings at different Z heights, and Slic3r can vary layer height, but in the general case, what you set for the slicer will apply to the entire model. Of course, a gcode file is nothing more than a text file, so if you are industrious, you can manually merge two or more files into one.
A manual merge is a pain, which is why I wrote gblend. It can stitch together gcode files to get various effects. The program takes multiple gcode files in as inputs and can combine them in different ways. The most useful feature allows you to get a certain number of layers from each source file and combine them into a single print. Measurements are in millimeters, so you don’t have to worry about layer numbers. The entire process is much easier than anything else I’ve come across.
When to Use Multiple Slicing
For a common solid object, you don’t really want 100% infill. It takes too long to print, and it also can cause problems with warping. Practically, a 20% or 30% infill is strong enough for most purposes. However, there is a common case where you don’t want any infill: if you are making a vase or cup.
In the case of a vase or a cup, you are really only printing the walls of the object and you want the inside to be completely empty. Most slicers have a “vase” or “spiral” mode that will do this automatically. When set, the resulting gcode will trace the outline of the object with a single plastic filament. There won’t be any layers, just a coil of plastic building the entire shape.
The rocket in the picture is a model from Thingiverse that is meant to be printed using a spiral or vase slice. However, I imported the model into OpenSCAD and added a 20mm high base (this would make a good award-style trophy if you added a name plate).
Ideally, you’d like the base to be solid (well, as I mentioned, 20% or 30% infill). Printing the rocket solid, though, is a waste of plastic and changes the item’s appearance since it will have layers instead of a single filament.
Solid vs Spiral Slicing
When you slice the entire model as a solid object, it becomes a series of layers. To the left you can see ten layers from the middle of the base at the bottom of the rocket. Each layer has diagonal lines in one direction and the layers alternate. Taken together, you get this crisscross pattern (although you can select other patterns in the slicer software). The tube of the rocket, unfortunately, looks the same. To the right you can see ten layers from somewhere along the tube.
Remember, both of those pictures are only ten layers. When you slice the model as a spiral, each layer contains just one spot, and the layer distance becomes very small. Ten layers for the spiral sliced model would just be a small line segment made up of ten dots. Here’s about 1,000 spiral layers near the rocket’s fins:
Notice the tube is hollow and the 1,000 layers makes just a few concentric rings. Once the files are blended, you’d expect to see the base as a cross hatched, layered object and the rocket body as a hollow tube all in one file.
Blending the Files
The key is to slice the same model twice. One time you slice the entire thing solid. The second time you slice it all with the spiral slice setting active. Knowing the base is 20mm high, you can use gblend to select portions of each file. You can see a video walk through of the process below.
The gblend software is a command line tool. To use it, you do need to make a small modification to your slicer’s configuration. A slicer will have somewhere to set your start and end gcode. This is usually code that will start the printer’s extruder, set temperatures, and send calibration data to the printer. At the end of the start gcode, you need to add a comment:
At the beginning of the end code, you need to set a similar comment:
Because these are comments, it is perfectly fine to leave them in all the time. You also need to make a copy of your desired start and end codes and put them in separate files for use later. The gblend software will ignore everything before the start comment and after the end comment, so you will need to have the start and end codes added in to the new blended file.
Once this is set up, just slice the model as you usually would, saving each time to a different file name. In my case, I wound up with four files:
- start.gcode (you can use this file with any model)
- end.gcode (used with any model)
- rocketstat-solid.gcode (the model with a 20% infill)
- rocketstat-spiral.gcode (the model with a spiral slice)
The command line tool should work under Linux or Windows (you might find it easier to use Cygwin if you use Windows and there are prebuilt binaries on Github). Here’s the command line I used:
gblend = start.gcode [ rocketstat-solid.gcode 20.0 rocketstat-spiral.gcode ] = end.gcode >rocketstat.gcode
The project’s home page explains all the options, but for this example, all you need to know is that the equal sign copies a file to the output; the open bracket gets the start of a file; and the 20.0 stops the first file at the 20mm mark and starts the next file. The close bracket tells gblend to take the rocketstat-spiral.gcode file all the way to the end.
Beyond the Basic
The resulting rocketstat.gcode file will print and have a solid base and a hollow rocket. Of course, you could get lots of effects using this technique: Different layer heights, fill patterns, cooling settings, speeds–anything you can instruct the slicer to change. There’s no reason you can’t have multiple segments, too. For example, I could have switched back to the solid model for the tip of the rocket, or selected a third gcode file if I wanted to.
While it isn’t rocket science (despite the printed model), it does automate an otherwise tedious task. Give it a try!