Follow our guide and learn how to generate custom G-codes for colorful prints.
Did you like our 4-color mountain sample print? Then you should try this neat trick with other objects too! All you need to do is to prepare the model and generate custom G-codes for it. Here’s a step-by-step guide on how to do this.
Important notice 1: This tutorial is recommended for advanced users only.
Important notice 2: To complete all actions from this guide you’ll need a 3D model you want to print in 4-colors, additive manufacturing software like Netfabb or Meshmixer, and Voxelizer slicer. Also, be prepared to take some notes during the process.
Important notice 3: This guide describes only the G-code generation process. On how to print your object please follow our 4-color mountain printing guide.
Now, you need to cut your model into parts in places that you want to stop the fabrication process in order to switch the filament. Use the Z-axis slider to determine the cutting height and take note of these values as you’ll need them later.
We cut our mountain into 3 parts but you can make as many cuts and filament switches as you want.
Export each part as a separate STL file, close Netfabb/Meshmixer and launch Voxelizer.
In Voxelizer slicer software choose 3D printing workflow, use Import aligned models option, import all STL files made in Netfabb/Meshmixer, and click Voxelize.
In Voxel editor open Materials toolbar and add new materials that will be later assigned to each part of the model. In our 4-color mountain sample, the bottom part was printed with solid color and two other included gradients but you can modify this according to your preferences. Simply change the type of the material from simple to gradient or complex and set your color mix.
Remember that colors in Materials toolbar do not represent actual material colors! Green color represents the left extruder and the amount of filament you want to extrude from it into the mix. Blue represents the right extruder of DUAL PRO toolhead.
Once you have your colors and gradients ready, switch to Object selection mode, right click on each part of the model and assign the materials that you created earlier.
If you want to achieve smooth color transitions, then remember to start each new part of the model with the same color that ends the previous one. For example, if your gradient in the bottom part is finished with yellow filament, then we recommend starting the middle part with yellow too. Otherwise, you’ll get hard cuts in color at the end of each part.
Unclick Object selection mode and click Show advanced. In the Project tab click Add custom G-code and open its settings by clicking on the gear icon.
Choose On desired y from the list and click Add. First, you need to set the height for the first filament change after printing the bottom part of your model. In Desired y box type in the height of the model, you know from Netfabb. Then add the following code into the textbox below.
G1 Z? F1000 (Important: "?" needs to be replaced with the height in mm on which you want to stop the extruder)
G0 X0 F2400
This command will:
Stop the extruder and raise it to the assigned Z height.
Move the extruder to the 0 position on the X axis.
Turn off the heaters.
When typing in this command, make sure that the Z value is higher than the Desired y value so the extruder doesn’t touch the model when traveling to 0 positions.
Also, please note that your custom G-codes will stop working at specific stages of printing. To restart the process you need to type in a restart command manually. We described and explained these commands in our 4-color mountain printing guide.
Now you need to repeat the above actions for the middle part of your model or any number of parts between the bottom and top layer of your object. The top part doesn’t require any additional custom G-codes because you will feed the required material before it starts printing.
After you add enough custom G-codes, simply click Generate G-code and save it on your computer or the SD card.
Using this guide you managed to create custom G-codes for a 4-color 3D print that includes color gradients. You can use these tips to create as many filament switches as you want and achieve even more colorful objects as a result - feel free to experiment!
The next logical step would be to 3D print your object using tricks described in our 4-color mountain sample guide.
Your email address will not be published.