Skip to content

Instantly share code, notes, and snippets.

@jewzaam
Last active April 8, 2018 00:25
Show Gist options
  • Save jewzaam/9f43dd0607ffb39a23967366121d1174 to your computer and use it in GitHub Desktop.
Save jewzaam/9f43dd0607ffb39a23967366121d1174 to your computer and use it in GitHub Desktop.
OctoPrint-MultiColors Configuration

https://github.com/MoonshineSG/OctoPrint-MultiColors

I slice with Slic3r and have enabled verbose GCODE. I found GOCDE to move the hot end off the print at a layer change (reference eludes me right now). Wanted to share what I did with this OctoPrint plugin for my setup.

The trick is to get the retract, extrucsion reset, and Z change captured in a group so you can replay it.

My regex: (.*layer [(]{0}[)])\n(G1 X.*move.*)\n(G1 E([\d.]*) F([\d.]*)[; ]*.*unretract)

My GCODE:

; PAUSE
M117 Color Change
G91 ; Set Relative Coordinates (Marlin also Extrusion)
M83 ; Set Relative Extrusion
G1 E-5.000000 F500 ; Retract 5mm
G1 Z15 F300 ; move Z up 15mm
G90 ; Set Absolute Coordinates
G1 X20 Y20 F9000 ; Move to hold position
G91 ; Set Relative Coordinates
G1 E-40 F500 ; Retract 40mm
M0 ; Idle Hold
G90 ; Set Absolute Coordinates
G1 F5000 ; Set speed limits
G28 X0 Y0 ; Home X Y
; RESUME (retract, reset extruder, move XY, move Z, unretract)
G1 E-\5 F\6 ; retract
M82 ; Set extruder to Absolute Mode
G92 E0 ; reset extrusion distance
\3
\2
\4
G1 E260.93009 F1800.00000 ; retract
G92 E0 ; reset extrusion distance
G1 Z1.400 F9600.000 ; move to next layer (5)
G1 X191.735 Y167.287 F9600.000 ; move to first perimeter point
G1 E1.90000 F1800.00000 ; unretract
; multi color
; PAUSE
M117 Color Change
G91 ; Set Relative Coordinates (Marlin also Extrusion)
M83 ; Set Relative Extrusion
G1 E-5.000000 F500 ; Retract 5mm
G1 Z15 F300 ; move Z up 15mm
G90 ; Set Absolute Coordinates
G1 X20 Y20 F9000 ; Move to hold position
G91 ; Set Relative Coordinates
G1 E-40 F500 ; Retract 40mm
M0 ; Idle Hold
G90 ; Set Absolute Coordinates
G1 F5000 ; Set speed limits
G28 X0 Y0 ; Home X Y
; RESUME (prepare for first unextract, reset extruder, layer change)
G1 E-1.90000 F1800.00000 ; retract
M82 ; Set extruder to Absolute Mode
G92 E0 ; reset extrusion distance
G1 Z1.400 F9600.000 ; move to next layer (5)
G1 X191.735 Y167.287 F9600.000 ; move to first perimeter point
G1 E1.90000 F1800.00000 ; unretract
M204 S1200 ; adjust acceleration
G1 E260.93009 F1800.00000 ; retract
G92 E0 ; reset extrusion distance
G1 Z1.400 F9600.000 ; move to next layer (5)
G1 X191.735 Y167.287 F9600.000 ; move to first perimeter point
G1 E1.90000 F1800.00000 ; unretract
M204 S1200 ; adjust acceleration
@MoonshineSG
Copy link

can you post a sample of your original gcode (as it came out of the slicer) ?

@MoonshineSG
Copy link

If does not affect that the matching line is inserted before (by the plugin) and after (by your \1 reference) ?

@jewzaam
Copy link
Author

jewzaam commented Apr 2, 2017

Added snippets of gcode with lines before and after match. Also fixing extrusion on restart.

@jewzaam
Copy link
Author

jewzaam commented Apr 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment