Notifications
Clear all

Printing 9 colors in one layer  

  RSS
TickTock
(@ticktock)
Estimable Member
Printing 9 colors in one layer

For DEI June, I decided to print a custom license plate frame for my truck.  Thought it would a a quick project but the software does not make it easy to print more than 5 colors in one layer right now.  I finally got it based on clues from various other threads but thought I'd share my final solution for anyone else desiring to do something similar and to solicit inputs because this solution definitely could be improved upon.

  1. Printers-->General : Increase number of extruders from 5 to 9
  2. Printers-->Custom G-code : replace the Tool chage G-code with the following:
    ; Change Tool[previous_extruder] -> Tool[next_extruder] (layer [layer_num])
    {
    local next_extruder_really = next_extruder;
    if next_extruder>4 then
          next_extruder_really = next_extruder-4;
    endif
    local max_speed_toolchange = 350.0;
    local wait_for_extruder_temp = true;
    position[2] = position[2] + 2.0;
    
    local speed_toolchange = max_speed_toolchange;
    if travel_speed < max_speed_toolchange then
          speed_toolchange = travel_speed;
    endif
    "G1 F" + (speed_toolchange * 60) + "
    ";
    "M117 Check Color of extruder " + next_extruder_really + " is " + next_extruder + " : " + extruder_colour[next_extruder] + "
    ";
    "M1 S4
    ";
    "T" + next_extruder_really + " S1 L0 D0
    ";
          "M600
    ";
    
    if wait_for_extruder_temp and not((layer_num < 0) and (next_extruder == initial_tool)) then
          "P0 S1 L2 D0
    ";
          "; " + layer_num + "
    ";
          if layer_num == 0 then
                "M109 S" + first_layer_temperature[next_extruder] + " T" + next_extruder_really + "
    ";
          else
                "M109 S" + temperature[next_extruder] + " T" + next_extruder_really + "
    ";
          endif
    endif
    "T" + next_extruder_really + " S1 L0 D0
    ";
    }
  3. Filaments -->Minimal purge on wipe tower : set to zero   (this was to prevent big blobs on the wipe tower)
  4. Print Settings-->Output Options : Add the following G-code substitutions
  5. Define the colors for each of the nine extruders and assign to appropriate model sections:
Opublikowany : 06/06/2025 8:39 pm
1 ludzie polubili
TickTock
(@ticktock)
Estimable Member
Topic starter answered:
RE: Printing 9 colors in one layer

Didn't mean to post already.  Was still editing but now I can't (I really wish this site allowed us to edit our posts). But anyway.  This approach will prompt for color changes every time the extruder changes.  Half the times you just pull it out an inch and put it back since it is already correct.  Someone more savvy than me can probably figure out how to only prompt the color change when necessary but that requires the code to remember what the last color for a particular extruder is and I have not figured out how to do that.

Opublikowany : 06/06/2025 8:55 pm
1 ludzie polubili
TickTock
(@ticktock)
Estimable Member
Topic starter answered:
RE: Printing 9 colors in one layer

My daughter asked me to print one for her so I had a chance to iterate and improve things a bit.  I realized that it is more efficient to keep 4/5 print heads the same and do all the swapping on one extruder.  So my tool change gcode is now:

; Change Tool[previous_extruder] -> Tool[next_extruder] (layer [layer_num])
{
local next_extruder_really = next_extruder;
if next_extruder>4 then
      next_extruder_really = 4;
endif

local next_color = extruder_colour[next_extruder];
if next_color == "#000000" then next_color = "BLACK"
elsif next_color == "#FFFFFF" then next_color = "WHITE"
elsif next_color == "#FF0000" then next_color = "RED"
elsif next_color == "#FF8000" then next_color = "ORANGE"
elsif next_color == "#FFFF00" then next_color = "YELLOW"
elsif next_color == "#00FF00" then next_color = "GREEN"
elsif next_color == "#0000FF" then next_color = "BLUE"
elsif next_color == "#FF00FF" then next_color = "MAGENTA"
elsif next_color == "#00FFFF" then next_color = "CYAN"
endif;

local max_speed_toolchange = 350.0;
local wait_for_extruder_temp = true;
position[2] = position[2] + 2.0;

local speed_toolchange = max_speed_toolchange;
if travel_speed < max_speed_toolchange then
      speed_toolchange = travel_speed;
endif
"G1 F" + (speed_toolchange * 60) + "
";
if next_extruder_really == 4 then
      "M117 Check Color of extruder 5 is " + next_color + "
";
      "M400
";
      "T" + next_extruder_really + " S1 L0 D0
";
      "M600
";
endif
if wait_for_extruder_temp and not((layer_num < 0) and (next_extruder == initial_tool)) then
      "P0 S1 L2 D0
";
      "; " + layer_num + "
";
      if layer_num == 0 then
            "M109 S" + first_layer_temperature[next_extruder] + " T" + next_extruder_really + "
";
      else
            "M109 S" + temperature[next_extruder] + " T" + next_extruder_really + "
";
      endif
endif
"T" + next_extruder_really + " S1 L0 D0
";
}

Also, the gcode substitutions get a lot simpler, too.  Just need two regular expression substitutions (remove quotes):

  1. Find: "^T[5-8]" and Replace: "" 
  2. Find: "T[5-8]" and Replace: "T4"
Opublikowany : 07/06/2025 1:54 pm
1 ludzie polubili
Share: