Please explain: custom named and defined tokens per material

Post Reply
b-morgan
Posts: 7
Joined: 06 Apr 2018, 13:34

Please explain: custom named and defined tokens per material

Post by b-morgan »

The lack of a good manual for 1.6.2 is depressing :(

In the 1.6.2 Features under G-CODE IMPROVEMENTS is this bullet:
  • New G-code Tokens for box temperature, prime pillar position, and the tuning value, and custom named and defined tokens per material
Can someone explain what these tokens are (by name) and how does "custom named and defined tokens per material" work (i.e. how do you use it)?

I've searched kisslicertalk.com, the internet (with Google) and can't find any useful information using "custom named and defined tokens per material" as a search string.
User avatar
pjr
Posts: 692
Joined: 05 May 2015, 10:27
Location: Kamnik, Slovenia

Re: Please explain: custom named and defined tokens per mate

Post by pjr »

Well, all the built-in tokens are listed on the Settings/Printer G-code tab.

Most are fairly self-explanatory and very few are needed to generate great prints.

Only a couple may need explanation:

<MATL> this token is replaced in the generated G-code by the content of the upper left box on the Settings/Matl G-code tab

<TUNINGVAL> this token is replaced when the Wizards/Tuning Wizards is active and set to <TUNINGVAL> G-code token only. A good example of this is tuning for Linear Advance. Set [*]N Layers to 1 and in the N[*] Layers tab, enter

Code: Select all

M900 K<TUNINGVAL>
User-defined tokens can be created per material; you may find that every time you change extruder (material) that you need a material-specific setting not available elsewhere, so create your own token and add that token in the appropriate Printer G-code section.

Hope this helps.

Peter
b-morgan
Posts: 7
Joined: 06 Apr 2018, 13:34

Re: Please explain: custom named and defined tokens per mate

Post by b-morgan »

I guess I'm just slow or getting senile. Can you provide an example of a per material user-defined token, please?

I am trying to get my LulzBot TAZ 6 with both the original single extruder and with the Dual Extruder V3 configured so I can use KISSlicer on a regular basis.

I print with PLA, PET-G, a little ABS, and PLA/PVA.

The TAZ 6 start gcode is fairly complex as it involves nozzle wiping (with temperature changes) and auto-leveling in addition to the usual homing of the X, Y, and Z axis. Complicating this is the fact that the built-in tokens listed on the Settings/Printer G-code tab aren't being substituted in the printer G-code Prefix.
User avatar
pjr
Posts: 692
Joined: 05 May 2015, 10:27
Location: Kamnik, Slovenia

Re: Please explain: custom named and defined tokens per mate

Post by pjr »

Any chance you could copy/paste your prefix g-code section in a post?

It would also help if you did likewise from a slicer known to work as required.

Peter

P.S. Example custom material Gcode:

Code: Select all

<CURRENT_LA_SETTING>=[M900 K29.2    ; Linear Advance for this material]
<HOME_AND_RETURN>=[
G91   ; Set Relative
G1 Z1    ; Lift Z by 1mm
G90    ; Set Absolute
G1 X0 Y0 ; Home
G1 X<NEXTX> Y<NEXTY> ; move to next XY
G91    ; Set Relative
G1 Z-1    ; Lower Z by 1mm
G90    ; Set Absolute
]
Yes, it's a nonsense example, but I really don't have much use for this feature; others do. To use, you simple add <CURRENT_LA_SETTING> or <HOME_AND_RETURN> on a line within one of the Printer G-code tabs.

Peter
b-morgan
Posts: 7
Joined: 06 Apr 2018, 13:34

Re: Please explain: custom named and defined tokens per mate

Post by b-morgan »

Thank you for the examples, they helped alot!

Here are my current KISSlicer Prefix Gcode for both my single and my dual extruder. They don't work, of course, because Prefix doesn't know these tokens. I could try moving the temperatures to the custom material Gcode, but I don't know if that will help. The <BED> tokens appear more than once because CuraLE and Simplify3D have separate settings for the first layer.

Single extruder:

Code: Select all

;This G-Code has been generated for the LulzBot TAZ 6 with standard extruder
G26                     ; clear potential 'probe fail' condition
G21                     ; set units to Millimetres
M107                    ; disable fans
G90                     ; absolute positioning
M82                     ; set extruder to absolute mode
M104 S<WARM>            ; soften filament
M140 S<BED>             ; get bed heating up
G28 X Y                 ; home X and Y
G1 X-19 Y258 F1000      ; move to safe homing position
M109 R<WARM>            ; wait for temp
G28 Z                   ; home Z
G92 E0                  ; set extruder to zero
G1 E-15 F100           ; suck up XXmm of filament
M117 Wiping...
G1 X-17 Y100 F3000      ; move above wide wiper pad
G1 Z1                   ; push nozzle into wiper
G1 X-19 Y95 F1000        ; slow wipe
G1 X-19 Y90 F1000        ; slow wipe
G1 X-19 Y85 F1000        ; slow wipe
G1 X-11 Y90 F1000        ; slow wipe
G1 X-19 Y80 F1000        ; slow wipe
G1 X-11 Y95 F1000        ; slow wipe
G1 X-19 Y75 F2000        ; fast wipe
G1 X-11 Y65 F2000        ; fast wipe
G1 X-19 Y70 F2000        ; fast wipe
G1 X-11 Y60 F2000        ; fast wipe
G1 X-19 Y55 F2000        ; fast wipe
G1 X-11 Y50 F2000        ; fast wipe
G1 X-19 Y40 F2000        ; fast wipe
G1 X-11 Y45 F2000        ; fast wipe
G1 X-19 Y35 F2000        ; fast wipe
G1 X-11 Y40 F2000        ; fast wipe
G1 X-19 Y70 F2000        ; fast wipe
G1 X-11 Y30 Z2 F2000     ; fast wipe
G1 X-19 Y35 F2000        ; fast wipe
G1 X-11 Y25 F2000        ; fast wipe
G1 X-19 Y30 F2000        ; fast wipe
G1 X-11 Y25 Z1.5 F1000   ; slow wipe
G1 X-19 Y23 F1000        ; slow wipe
G1 Z10                   ; raise extruder
M117 Probing...
M204 S100               ; set accel for probing
G29                     ; probe sequence (for auto-leveling)
M204 S500               ; set accel back to normal
M104 S<MAIN>            ; set extruder temp
G1 X100 Y-25 Z5 F3000   ; move to open space
M400                    ; clear buffer
M117 Heating...
M140 S<BED>             ; get bed temping up
M109 R<MAIN>            ; set extruder temp and wait
M190 R<BED>             ; set bed temp and wait
G1 E0 F100              ; undo retraction
M117 Purging...
G92 E-25                ; set extruder negative amount to purge
G1 E0 F100              ; purge XXmm of filament
G1 Z0.5                 ; clear bed (barely)
G1 X100 Y0 F5000        ; move above bed to shear off filament
G1 Z2 F100              ; move Z up to (really) clear bed
M400                    ; clear buffer
M117 TAZ Printing...
Dual extruder:

Code: Select all

; This profile is designed for LulzBot TAZ6 3D Printer with the Dual V3 Yellowfin
G26                     ; clear potential 'probe fail' condition
G21                     ; set units to Millimetres
M107                    ; disable fans
G90                     ; absolute positioning
M218 T0 X0 Y0           ; Clear any tool offsets in firmware
M218 T1 X0 Y0           ; offset for right extruder
M104 S<WARM1> T0        ; soften filament
M104 S<WARM2> T1        ; soften filament
M140 S<BED>             ; get bed heating up
G28 X Y                 ; home X and Y
G1 X-17 F3000           ; clear X endstop
G1 Y258 F3000           ; move over the Z_MIN switch
G1 X-19 F3000           ; move left as far as possible
M117 Heating...         ; LCD status message
M109 R<WARM1> T0        ; wait for temp
M109 R<WARM2> T1        ; wait for temp
T0                      ; return to first extruder
G28 Z                   ; home Z
T0                      ; select this extruder first
M82                     ; set extruder to absolute mode
G92 E0                  ; set extruder to zero
G1  E-15 F100           ; suck up XXmm of filament
T1                      ; switch extruders
M82                     ; set extruder to absolute mode
G92 E0                  ; set extruder to zero
G1  E-15 F100           ; suck up XXmm of filament
M104 S<WARM1> T0        ; set to wipe temp
M104 S<WARM2> T1        ; set to wipe temp
M106                    ; Turn on fans to speed cooling
M104                    ; Disable autotemp
M117 Cooling...         ; LCD status message
M109 R<WARM1> T0        ; wait for T0 to reach temp
M109 R<WARM2> T1        ; wait for T1 to reach temp
M107                    ; Turn off fan
T0                      ; switch extruders
M117 Wiping...
G1 X-17 Y100 F3000      ; move above wiper pad
G1 Z1                   ; push nozzle into wiper
G1 X-18 Y95 F1000       ; slow wipe
G1 X-18 Y90 F1000       ; slow wipe
G1 X-18 Y85 F1000       ; slow wipe
G1 X-17 Y90 F1000       ; slow wipe
G1 X-18 Y80 F1000       ; slow wipe
G1 X-17 Y95 F1000       ; slow wipe
G1 X-18 Y75 F2000       ; fast wipe
G1 X-17 Y65 F2000       ; fast wipe
G1 X-18 Y70 F2000       ; fast wipe
G1 X-17 Y60 F2000       ; fast wipe
G1 X-18 Y55 F2000       ; fast wipe
G1 X-17 Y50 F2000       ; fast wipe
G1 X-18 Y40 F2000       ; fast wipe
G1 X-17 Y45 F2000       ; fast wipe
G1 X-18 Y35 F2000       ; fast wipe
G1 X-17 Y40 F2000       ; fast wipe
G1 X-18 Y70 F2000       ; fast wipe
G1 X-17 Y30 Z2 F2000    ; fast wipe
G1 X-18 Y35 F2000       ; fast wipe
G1 X-17 Y25 F2000       ; fast wipe
G1 X-18 Y30 F2000       ; fast wipe
G1 X-17 Y25 Z1.5 F1000  ; slow wipe
G1 X-18 Y23 F1000       ; slow wipe
G1 X-17 Z15             ; raise extruder
M117 Probing...
M204 S100               ; set accel for probing
G29                     ; probe sequence (for auto-leveling)
M204 S500               ; set accel back to normal
M104 S<MAIN1> T0        ; set extruder temp
M104 S<MAIN2> T1        ; set extruder temp
G1 X100 Y-17 Z0.5 F3000 ; move to open space
M400                    ; clear buffer
M117 Heating...         ; LCD status message
M109 R<MAIN1> T0        ; set extruder temp and wait
M109 R<MAIN2> T1        ; set extruder temp and wait
M117 Purging...         ; LCD status message
T0                      ; select this extruder first
G1  E0 F100             ; undo retraction
G92 E-25                ; set extruder negative amount to purge
G1  E0 F100             ; purge XXmm of filament
T1                      ; switch to second extruder
G92 E-15                ; reset global E
G1  E0 F100             ; undo retraction
G92 E-25                ; set extruder negative amount to purge
G1  E0 F100             ; purge XXmm of filament
G1 Z0.5                 ; clear bed (barely)
G1 X100 Y0 F5000        ; move above bed to shear off filament
T0                      ; switch to first extruder
M190 S<BED>             ; get bed temping up during first layer
G1 Z2 F75               ; move Z up to (really) clear bed
; M218 T1 X13 Y0          ; offset for right extruder
M400                    ; clear buffer
M117 TAZ Printing...    ; LCD status message
Last edited by b-morgan on 10 May 2018, 08:44, edited 2 times in total.
b-morgan
Posts: 7
Joined: 06 Apr 2018, 13:34

Re: Please explain: custom named and defined tokens per mate

Post by b-morgan »

Here are my start gcodes for Cura - LulzBot Edition (CuraLE) for the single extruder and the dual extruder V3. I have also included the end gcodes because there are some token substitutions in there as well.

Single start gcode:

Code: Select all

;This G-Code has been generated for the LulzBot TAZ 6 with standard extruder
G26                      ; clear potential 'probe fail' condition
G21                      ; set units to Millimetres
M107                     ; disable fans
G90                      ; absolute positioning
M82                      ; set extruder to absolute mode
G92 E0                   ; set extruder position to 0
M140 S{material_bed_temperature} ; start bed heating up
G28 XY                   ; home X and Y
G1 X-19 Y258 F1000       ; move to safe homing position
M109 R{material_soften_temperature} ; soften filament before homing Z
G28 Z                    ; home Z
G1 E-15 F100             ; retract filament
M109 R{material_wipe_temperature} ; wait for extruder to reach wiping temp
M117 Wiping...
G1 X-11 Y100 F3000       ; move above wide wiper pad
G1 Z1                    ; push nozzle into wiper
G1 X-19 Y95 F1000        ; slow wipe
G1 X-19 Y90 F1000        ; slow wipe
G1 X-19 Y85 F1000        ; slow wipe
G1 X-11 Y90 F1000        ; slow wipe
G1 X-19 Y80 F1000        ; slow wipe
G1 X-11 Y95 F1000        ; slow wipe
G1 X-19 Y75 F2000        ; fast wipe
G1 X-11 Y65 F2000        ; fast wipe
G1 X-19 Y70 F2000        ; fast wipe
G1 X-11 Y60 F2000        ; fast wipe
G1 X-19 Y55 F2000        ; fast wipe
G1 X-11 Y50 F2000        ; fast wipe
G1 X-19 Y40 F2000        ; fast wipe
G1 X-11 Y45 F2000        ; fast wipe
G1 X-19 Y35 F2000        ; fast wipe
G1 X-11 Y40 F2000        ; fast wipe
G1 X-19 Y70 F2000        ; fast wipe
G1 X-11 Y30 Z2 F2000     ; fast wipe
G1 X-19 Y35 F2000        ; fast wipe
G1 X-11 Y25 F2000        ; fast wipe
G1 X-19 Y30 F2000        ; fast wipe
G1 X-11 Y25 Z1.5 F1000   ; slow wipe
G1 X-19 Y23 F1000        ; slow wipe
G1 Z10                   ; raise extruder
M109 R{material_probe_temperature} ; wait for extruder to reach probe temp
G1 X-9 Y-9               ; move above probe
M204 S100                ; set accel for probing
G29                      ; probe sequence (for auto-leveling)
M204 S500                ; set accel back to normal
G1 X100 Y-17 Z2 F3000    ; move to open space
M400                     ; clear buffer
M117 Heating...          ; LCD status message
M140 S{material_bed_temperature_layer_0}; get bed heating up
M109 R{material_print_temperature_layer_0} ; wait for extruder to reach printing temp
M190 R{material_bed_temperature_layer_0} ; wait for bed to reach printing temp
G1 E0 F100               ; extrude filament back into nozzle
M117 Purging...          ; LCD status message
G92 E-25                 ; set extruder negative amount to purge
G1 E0 F100               ; purge XXmm of filament
G1 Z0.5                  ; clear bed (barely)
G1 X100 Y0 F5000         ; move above bed to shear off filament
G1 Z2 F100               ; move z up
M117 TAZ Printing...     ; LCD status message
Dual V3 start:

Code: Select all

; This profile is designed for LulzBot TAZ6 3D Printer with the Dual V3 Yellowfin
G26                          ; clear potential 'probe fail' condition
G21                          ; set units to Millimetres
M107                         ; disable fans
G90                          ; absolute positioning
M218 T0 X0 Y0                ; Clear any tool offsets in firmware
M218 T1 X0 Y0                ; offset for right extruder
M104 S{material_soften_temperature_0} T0               ; soften filament
M104 S{material_soften_temperature_1} T1               ; soften filament
M140 S{material_bed_temperature}                       ; get bed heating up
G28 X Y                      ; home X and Y
G1 X-17 F3000                ; clear X endstop
G1 Y258 F3000                ; move over the Z_MIN switch
G1 X-19 F3000                ; move left as far as possible
M117 Heating...              ; LCD status message
M109 R{material_soften_temperature_0} T0               ; wait for temp
M109 R{material_soften_temperature_1} T1               ; wait for temp
T0                           ; return to first extruder
G28 Z                        ; home Z
T0                           ; select this extruder first
M82                          ; set extruder to absolute mode
G92 E0                       ; set extruder to zero
G1  E-15 F100                ; suck up XXmm of filament
T1                           ; switch extruders
M82                          ; set extruder to absolute mode
G92 E0                       ; set extruder to zero
G1  E-15 F100                ; suck up XXmm of filament
M104 S{material_wipe_temperature_0} T0                 ; set to wipe temp
M104 S{material_wipe_temperature_1} T1                 ; set to wipe temp
M106                         ; Turn on fans to speed cooling
M104                         ; Disable autotemp
M117 Cooling...              ; LCD status message
M109 R{material_wipe_temperature_0} T0                 ; wait for T0 to reach temp
M109 R{material_wipe_temperature_1} T1                 ; wait for T1 to reach temp
M107                         ; Turn off fan
T0                           ; switch extruders
G1 X-17 Y100 F3000           ; move above wiper pad
G1 Z1                        ; push nozzle into wiper
G1 X-18 Y95 F1000            ; slow wipe
G1 X-18 Y90 F1000            ; slow wipe
G1 X-18 Y85 F1000            ; slow wipe
G1 X-17 Y90 F1000            ; slow wipe
G1 X-18 Y80 F1000            ; slow wipe
G1 X-17 Y95 F1000            ; slow wipe
G1 X-18 Y75 F2000            ; fast wipe
G1 X-17 Y65 F2000            ; fast wipe
G1 X-18 Y70 F2000            ; fast wipe
G1 X-17 Y60 F2000            ; fast wipe
G1 X-18 Y55 F2000            ; fast wipe
G1 X-17 Y50 F2000            ; fast wipe
G1 X-18 Y40 F2000            ; fast wipe
G1 X-17 Y45 F2000            ; fast wipe
G1 X-18 Y35 F2000            ; fast wipe
G1 X-17 Y40 F2000            ; fast wipe
G1 X-18 Y70 F2000            ; fast wipe
G1 X-17 Y30 Z2 F2000         ; fast wipe
G1 X-18 Y35 F2000            ; fast wipe
G1 X-17 Y25 F2000            ; fast wipe
G1 X-18 Y30 F2000            ; fast wipe
G1 X-17 Y25 Z1.5 F1000       ; slow wipe
G1 X-18 Y23 F1000            ; slow wipe
G1 X-17 Z15                  ; raise extruder
M109 R{material_probe_temperature_0} T0                    ; heat to probe temp
M109 R{material_probe_temperature_1} T1                    ; heat to probe temp
M204 S100                    ; set accel for probing
G29                          ; probe sequence (for auto-leveling)
M204 S500                    ; set accel back to normal
M104 S{material_print_temperature_0} T0                 ; set extruder temp
M104 S{material_print_temperature_1} T1                 ; set extruder temp
G1 X100 Y-17 Z0.5 F3000      ; move to open space
M400                         ; clear buffer
M117 Heating...              ; LCD status message
M109 R{material_print_temperature_0} T0                 ; set extruder temp and wait
M109 R{material_print_temperature_1} T1                 ; set extruder temp and wait
M117 Purging...              ; LCD status message
T0                           ; select this extruder first
G1  E0 F100                  ; undo retraction
G92 E-25                     ; set extruder negative amount to purge
G1  E0 F100                  ; purge XXmm of filament
T1                           ; switch to second extruder
G92 E-15                     ; reset global E
G1  E0 F100                  ; undo retraction
G92 E-25                     ; set extruder negative amount to purge
G1  E0 F100                  ; purge XXmm of filament
G1 Z0.5                      ; clear bed (barely)
G1 X100 Y0 F5000             ; move above bed to shear off filament
T0                           ; switch to first extruder
M190 S{material_bed_temperature_layer_0}               ; get bed temping up during first layer
G1 Z2 F75                    ; move Z up to (really) clear bed
M400                         ; clear buffer
M117 TAZ Printing...         ; LCD status message
Single end:

Code: Select all

M400                              ; wait for moves to finish
M140 S{material_part_removal_temperature} ; start bed cooling
M104 S0                           ; disable hotend
M107                              ; disable fans
G91                               ; relative positioning
G1 E-1 F300                       ; filament retraction to release pressure
G1 Z20 E-5 X-20 Y-20 F3000        ; lift up and retract even more filament
G1 E6                             ; re-prime extruder
M117 Cooling please wait
G90                               ; absolute positioning
G1 Y0 F3000                       ; move to cooling position
M190 R{material_part_removal_temperature} ; wait for bed to cool down to removal temp
G1 Y280 F3000                     ; present finished print
M140 S{material_keep_part_removal_temperature_t}; keep temperature or cool downs
M84                               ; disable steppers
M117 Print complete               ; progress indicator message
Dual V3 end:

Code: Select all

;Dual Extruder V3, end.gcode
M400
M104 S0 T0                     ; T0 hotend off
M104 S0 T1                     ; T1 hotend off
M107                           ; fans off
G91                            ; relative positioning
M83                            ; extruder relative positioning
T0                             ; select left extruder first
G1 E-1 F300                    ; retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z20 E-5 X-20 Y-20 F3000     ; move Z up a bit and retract filament even more
G1 E6                          ; re-prime extruder 1
T1                             ; select right extruder
G1 E-1 F300                    ; retract the filament a bit
G1 E-5 F3000                   ; retract filament even more
G1 E6                          ; re-prime extruder 2
T0                             ; re-select left extruder
M117 Cooling please wait       ; progress indicator message
G90                            ; absolute positioning
G1 Y0 F3000                    ; move to cooling position
M190 R{material_part_removal_temperature} ; set bed to cool off
G1 Y280 F3000                  ; present finished print
M140 S{material_keep_part_removal_temperature_t} ; keep temperature or cool downs
M84                            ; steppers off
M117 Print complete            ; progress indicator message
User avatar
pjr
Posts: 692
Joined: 05 May 2015, 10:27
Location: Kamnik, Slovenia

Re: Please explain: custom named and defined tokens per mate

Post by pjr »

OK, just checked the single extruder and you are using incorrect tokens.

<WARM> and <MAIN> are not valid; they should be <WARM1> and <MAIN1>

Peter
User avatar
pjr
Posts: 692
Joined: 05 May 2015, 10:27
Location: Kamnik, Slovenia

Re: Please explain: custom named and defined tokens per mate

Post by pjr »

For the dual extruder, M104 (according to G-code wiki) does not have a T option: http://reprap.org/wiki/G-code#M104:_Set ... emperature

So you may have to select each tool before setting the temp. But I don't know your printer, so I may be very wrong!

Peter

P.s. will have a look at your second post later (sorry, very busy at the moment...)
b-morgan
Posts: 7
Joined: 06 Apr 2018, 13:34

Re: Please explain: custom named and defined tokens per mate

Post by b-morgan »

pjr wrote:For the dual extruder, M104 (according to G-code wiki) does not have a T option: http://reprap.org/wiki/G-code#M104:_Set ... emperature
You are correct in that neither http://marlinfw.org/docs/gcode/M104.html nor http://reprap.org/wiki/G-code#M104:_Set ... emperature show a T option for M104 or M109 but I started with the start gcode as delivered from LulzBot which does use a T option. A quick look at the Marlin 1.1.8 sources shows that the T option is valid for M104, M105, and M109.

I changed <WARM> to <WARM1> and <MAIN> to <MAIN1> in my single extruder start code and sliced a model. That fixed the issue and it looks like token substitution is active in the Prefix code.
Post Reply