1 / 1
Random Color Change Script (Orca/Prusa) — image 1

Random Color Change Script (Orca/Prusa)

Order a print of this model

We calculate the final price from your selected file. You review and accept it before payment.

Saved on this device.

This inserts random filament changes into GCode

Rating
0 / 5
Likes
0
Downloads
6
Makes
0
Views
68
Reviews
0

Updated at source:

Model information

Category
Other Ideas
License
Creative Commons — Attribution — Noncommercial

Orca/Prusa slicer post-processing script that inserts random color changes.
I created it to do more realistic wood-like prints, using 3 different shades of wood filament.

Your printer uses T commands already? (most likely)  Use Normal MMU Users instructions.
DIY MMU Users need to read the last section.

Normal MMU Users:

You'll need to add the script to a folder where it will be safe and then tell your slicer where it is.
In Orca you go to Process, Other, then Post-Processing Scripts.  Also, if not already set up, you'll need to tell it where python is installed (must be installed).  

Enter this (using your locations): 
"C:\PATH\TO\PYTHON\\python.exe" "C:\PATH\TO\THE\SCRIPT\RandomColorChange.py";

If it works properly you'll briefly see a black window come up during gcode export or sending the print.  This is the script running the randomization.  To preview the random colors you can export the gcode, then open it in your slicer to see the actual colors.

One current issue is that there is no way to have it purge the right amount of each color.  This is actually desirable for the wood-filament use case, since it will blend colors.  To get around this you can make the last layer a tool change in the slicer so it generates a purge tower.  This will at least have it get started on the next color inside the tower instead.

The example default config is set for 3 colors and starts randomizing at layer 0 with a 50% chance that the next layer will be a random color change.

Change these variables in the RandomColorChange.py code to change the amount of colors or make it start at a certain layer height.

# Pre-set Example Configuration
CHANGE_PROBABILITY = 0.5                     # 50% CHANCE
MIN_LAYERS_BETWEEN = 2                       # 2 LAYERS SAME COLOR MINIMUM
AVAILABLE_TOOLS = ["T0", "T1", "T2"]         # TOOLS (colors)
START_LAYER = 0                              # LAYER TO START SCRIPT


DIY MMY / No T-Commands:


I run this on a 3D Chameleon MMU off a secondary MCU (btt skr) connected to a Klipper printer.  I didn't have simple T commands to use, so I had to go about this differently.  I have my T commands set up to call my existing 3dChameleon macros for selecting the next filament.  I had to use a new T_CHANGE macro and save the current tool as a variable. 

I have attached my 3DChameleon configs so you can see how I accomplished this (T_CHANGE at the bottom of config)

The important parts of the 3DChameleon Config are the [T0]-[T7] macros,  [_CHAMELEON_VARIABLES], [INITIALIZE_TOOL_STATE], and [T_CHANGE].    These are not necessary for printers that use T for tool changes already.

Tags