AdSense

Saturday 10 November 2018

Semi-automatic Multi-Colour Printing with the Ultimaker 2+

(Deutsche Version) For nearly 2 years nothing has been happening on this blog and it's time to change that. The current project I'm working on is to equip an Ultimaker 2+ for multi-material printing, being able to print up to 15 different colours. I will post more about that in the future, after finishing the project. Today, I want to present the pre-stage to this: A semi-automatic multi-colour printing Ultimaker 2+. The basic idea is to only use one nozzle and pull out the old material and then insert the next colour, similar to the Prusa i3 Multi-Material Upgrade.

What do I mean by semi-automatic? The printer is printing with a single colour. At one point, he stops, throws out the material and then waits till the next material is inserted. This is suitable for easy parts which consist of a basic colour and then, after reaching a certain height, change their colour. Examples for this could be some writing on an object, a traffic cone (https://www.thingiverse.com/thing:3207478) or in the area of tabletop terrain these farm fields (https://www.thingiverse.com/thing:3207486).

The big question is: What did I have to change at the printer? And the great answer is: Nothing! Therefore it was really easy to implement this multi-colour printing. I was using "Slic3r" as slicer because I can add user defined G-Code and the software is suitable for any amout of extruders. I will now explain step-by-step how my printing profiles in Slic3r looked like. First, the Printer Settings in Slic3r:

I used the following settings for every extruder:

In the area Custom G-code, I placed these snippets:
Start G-code
M109 S[first_layer_temperature] ; heat nozzle to first layer temperature and wait until reached
G21 ; metric values
G90 ; absolute positioning
M82 ; Extruder to Absolute
G28 ; home all axes
G1 X7 Y7 F6000 ; bring extruder to the front
G1 Z25 F2000 ; Raise Bed to Head
G92 E0 ; zero the extruded length
T0 ; Select Extruder 1
G92 E0 ; Zero Extrude L
G1 F200 E8 ; Extrude 16 @ 200mm/s
G92 E0 ; Zero Extrude L
G1 F50 E4 ; Extrude 16 @ 50mm/s
G92 E0 ; Zero Extrude L
G1 F20 E2 ; Extrude 2 @ 20mm/s
G1 X100 Y7 F6000 ; bring extruder to the front
G92 E0 ; Zero Extrude L
G92 E0 ; zero the extruded length again
End G-code
; Add Change Tool To Extruder 0 here

G92 E0 ; zero the extruded length
G1 E-2 F200 ; Extrude(Retract) -2mm @ 50mm/s
G28 ; home all
M104 S0 ; turn off heaters
M140 S0 ; turn off bed
M84 ; disable motors
Before layer change G-code
;XXX Before Layer Change
After layer change G-code
;LayerChange
G90 ; absolute positioning
G1 X190 Y190 F6000;

G92 E0 ; zero the extruded length
;G1 E7 F2100 ; Retraction compensation


;Prime Tower

;Prime Tower Routine
G91; Relative mode
G1 Z-1 F2100; Lower Head 1mm
G90 ; absolute positioning
G1 X180 Y190 F6000;
G91; Relative mode

;Rectangle around
G1 Y16 E7.1 F600
G1 X-128 E1 F1200
G1 Y-16 E0.1
G1 X128 E1
G1 Y-16 E0.1
G1 X-128 E1
G1 Y16 E0.1

;Prime Nozzle
;G1 X-128 F3600;No extrusion because part of border


G1 X16 Y-16 F6000
G1 Y32 E0.1 F1200
G1 X16  F6000
G1 Y-32 E0.1 F1200
G1 X16 F6000
G1 Y32 E0.1 F1200
G1 X16 F6000
G1 Y-32 E0.1 F1200
G1 X16 F6000
G1 Y32 E0.1 F1200
G1 X16 F6000
G1 Y-32 E0.1 F1200
G1 X16 F6000
G1 Y32 E0.1 F1200
G1 X16 F6000
;G1 E-7 F2100 ; Retract
G1 Y-32 E-6.9 F1200;No extrusion because part of border

G1 Z1 F2100; Raise Head 1mm

G90 ; absolute positioning
G92 E0 ; zero the extruded length


;Retract
;G92 E0
;LayerEnd
Tool change G-code
;XXX Tool Change
;M104 S100
G90 ; absolute positioning
G1 X190 Y190 F6000;

G92 E0 ; zero the extruded length
G1 E-399 F10000 ; Extrude(Retract) -500mm @ 50mm/s
G1 E-40[next_extruder] F30 ; Extrude(Retract) -1mm @ 1mm/s
G1 E-715 F10000 ; Extrude(Retract) -500mm @ 50mm/s

G92 E0 ; zero the extruded length
G1 F50 E-40 ; Extrude 8 @ 50mm/s

M0;

;M104 S[temperature_0]
G90 ; absolute positioning
G92 E0 ; zero the extruded length
G1 F50 E20 ; Extrude 8 @ 50mm/s

G92 E0 ; zero the extruded length
G1 E700 F10000 ; Extrude(Insert)500mm @ 50mm/s

G92 E0 ; zero the extruded length
G1 F50 E20 ; Extrude 16 @ 50mm/s


;Prime Tower

;Prime Tower Routine
G91; Relative mode
G1 Z-1 F2100; Lower Head 1mm
G90 ; absolute positioning
G1 X180 Y190 F6000;
G91; Relative mode

;Prime Nozzle
G1 Y1 F6000
G1 Y[next_extruder] F6000
G1 X-128 E2 F700
G1 Y-16 F6000
G1 X128 E2 F700
G1 Y-1 F6000
G1 Y-[next_extruder] F6000
G1 X-128 F6000

G1 X1 F6000
G1 X[next_extruder] F6000
G1 Y32 E0.2 F700
G1 X16 F6000
G1 Y-32 E0.2 F700
G1 X16 F6000
G1 Y32 E0.2 F700
G1 X16 F6000
G1 Y-32 E0.2 F700
G1 X16 F6000
G1 Y32 E0.2 F700
G1 X16 F6000
G1 Y-32 E0.2 F700
G1 X16 F6000
G1 Y32 E0.2 F700
G1 X16 F6000
G1 Y-32 E-6.8 F700

G1 Z1 F2100; Raise Head 1mm

G90 ; absolute positioning
G92 E0 ; zero the extruded length


;Retract
;G92 E0
;ToolEnd
Next thing are the Filament Settings for Filament and Cooling:







 
The largest block are the Print Settings with all their sub-categories:














You should place the correct path to the scripts. I had to write a post-script which edits my G-Code because Slic3r was adding T0, T1, ... for all the different extruders I don't have. If you feed your Ultimaker 2+ with a T1 command, the first (and only) extruder stops. The post script now does 2 things:
  • Replace all T1, T2, ... with T0
  • Compensate a retraction problem - Slic3r retracts tools which are not used and therefore pushes the material forwards into the nozzle after the tool change. This does not happen if the tool is used for the first time, because Slic3r did not pull out material from this tool yet. Therefore my post script checks whether an E7-command is there after a tool change and if not, adds this line to the G-Code
The post script is written in Octave (comparable to Matlab), you should also install this software. The post script "StartOctave.bat" looks like this:
C:\Octave\Octave-4.2.1\octave.bat C:\Slic3rSkripte\OctavePostScript.m %1
It basically calls the file "OctavePostScript.m":
s = argv(){1};

myfile = fopen("testOctave.txt", "w");
fprintf(myfile, "%s\r\n", s);
fclose(myfile);

%s = "I:\Traffic_Cone_Rings_Orange.gcode";
myfile = fopen (s, "r");
outText = [];
tline = fgetl(myfile);
i = 1;
outText{i} = tline;
while ischar(tline)
  i = i+1;
  outText{i} = tline;
 
 
  tline = fgetl(myfile);
end
imax = i;
fclose(myfile);

myfile = fopen(s, "w");
%fprintf(myfile, ";EDITED!\r\n");
insertLine = 0;
for i=1:imax
  tempLine = outText{i};
 
  if (size(tempLine,2) > 1)
    if (tempLine(1) == "T")
      outText{i} = "T0";
    end
  end
 
 
  if (strcmp(tempLine,";ToolEnd"))
    insertLine = 7;
  end
  
  if (insertLine > 0)
    insertLine = insertLine -1;
  end
 
  if (insertLine == 1)
    if (tempLine(4) == "E")
    else
      fprintf(myfile, "G1 E7.00000 F2100.00000\r\n");
      fprintf(myfile, "G92 E0 \r\n");
    end
  end

  fprintf(myfile, "%s\r\n", outText{i});
end
fclose(myfile);
Finally, an object has to be loaded into Slic3r. Now, right-click on it and choose settings and then "Load Part" to add further colour-objects. Here you can set which extruder the printer will be using. For first tests, you could use my thingiverse-links from above.

The source code is definitely improvable, if anyone has comments on this, please tell me. Always keep in mind that the code is built with the perspective of having an automatic material change, so some parts seem to be a bit complicated.

No comments:

Post a Comment