Avisos
Vaciar todo

Conditional gcode syntax in Slic3rPE 1.41.1  

  RSS
bobstro
(@bobstro)
Illustrious Member
Conditional gcode syntax in Slic3rPE 1.41.1

I'm trying to use conditional gcode syntax as described in the release notes for 1.38.2. I'm trying to generate a temperature calibration tower using the following syntax:

;BEFORE_LAYER_CHANGE
G92 E0.0
;layer_z is height of current layer in mm
;[layer_z]
{if layer_z == 91.6}M104 S220
{elseif layer_z == 81.6}M104 S225
{elseif layer_z == 71.6}M104 S230
{elseif layer_z == 61.6}M104 S235
{elseif layer_z == 51.6}M104 S240
{elseif layer_z == 41.6}M104 S245
{elseif layer_z == 31.6}M104 S250
{elseif layer_z == 21.6}M104 S255
{elseif layer_z == 11.6}M104 S260
{elseif layer_z == 1.6}M104 S265
{endif}

Attempts to generate gcode result in the following:

!!!!! Failed to process the custom G-code template before_layer_gcode
Parsing error at line 6: Not a variable name
{elseif layer_z == 81.6}M104 S225
^
!!!!! End of an error report for the custom G-code template before_layer_gcode

I've tried combining all of the lines into a single line with no better luck. This works, but is much more cumbersome:

;BEFORE_LAYER_CHANGE
; layer_z is height of current layer in mm
G92 E0.0
;[layer_z]
{if layer_z == 91.6}M104 S220{endif}
{if layer_z == 81.6}M104 S225{endif}
{if layer_z == 71.6}M104 S230{endif}
{if layer_z == 61.6}M104 S235{endif}
{if layer_z == 51.6}M104 S240{endif}
{if layer_z == 41.6}M104 S245{endif}
{if layer_z == 31.6}M104 S250{endif}
{if layer_z == 21.6}M104 S255{endif}
{if layer_z == 11.6}M104 S260{endif}
{if layer_z == 1.6}M104 S265{endif
}

Am I misunderstanding how elseif should work? I know Slic3rPE uses a different syntax from mainstream Slic3r.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 29/10/2018 7:11 pm
Peter in Katy
(@peter-in-katy)
Estimable Member
Re: Conditional gcode syntax in Slic3rPE 1.41.1

The post you referenced had the conditional as

elsif

Not elseif.

{if condition1} text on condition1 {elsif condition2} text on condition2 {else} text on else {endif}

Respondido : 29/10/2018 11:10 pm
bobstro
(@bobstro)
Illustrious Member
Topic starter answered:
Re: Conditional gcode syntax in Slic3rPE 1.41.1


The post you referenced had the conditional as

elsif

Not elseif.
Hah! That was it. I've encountered both "elseif" and "elif" before and I guess my mind was doing auto-correct. I've never seen "elsif" before. Made the change and all is working perfectly now. Thanks!

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 30/10/2018 2:24 am
Peter in Katy
(@peter-in-katy)
Estimable Member
Re: Conditional gcode syntax in Slic3rPE 1.41.1

Glad I could help.

It took me a couple looks to 'see' the error.
If I had a dime for every minute I've spent starting at code that should just work...

Respondido : 30/10/2018 2:59 am
Compartir: