Trouble using conditionals in Slic3r 1.38.6-prusa3d
 
Notifications
Clear all

[Closed] Trouble using conditionals in Slic3r 1.38.6-prusa3d  

  RSS
HeySideburns
(@heysideburns)
Trusted Member
Trouble using conditionals in Slic3r 1.38.6-prusa3d

I'm trying to add a custom end print step that will move the z to 50 if it is below 50 (to make it easier to remove the steel sheet). Based on the two sources listed below it seems like one of the following should work.

{if layer_z < 50}G1 Z50{endif}
{if [layer_z] < 50}G1 Z50{endif}

Both of them choke with an error on the layer_z placeholder however. What am I missing?

https://github.com/alexrj/Slic3r/wiki/Conditional-Gcode-Syntax-Spec indicates I need the braces around layer_z while this GitHub issue indicates it is ok to not have the braces: https://github.com/prusa3d/Slic3r/issues/683

Here is the error I am getting:

!!!!! Failed to process the custom G-code template end_gcode
Parsing error at line 7.
{if [layer_z] < 50.0}G1 Z50
^
!!!!! End of an error report for the custom G-code template end_gcode

Thanks.

Posted : 01/03/2018 5:08 am
richard.l
(@richard-l)
Member Moderator
Re: Trouble using conditionals in Slic3r 1.38.6-prusa3d

Have you tried the latest beta version of Slic3r?

https://github.com/prusa3d/Slic3r/releases/tag/version_1.39.1-beta1

Posted : 01/03/2018 3:08 pm
HeySideburns
(@heysideburns)
Trusted Member
Topic starter answered:
Re: Trouble using conditionals in Slic3r 1.38.6-prusa3d


Have you tried the latest beta version of Slic3r?

https://github.com/prusa3d/Slic3r/releases/tag/version_1.39.1-beta1

I tried this morning with no luck. I actually get different errors if I use the brackets vs. not.

With the brackets it has an error parsing the line:
!!!!! Failed to process the custom G-code template end_gcode
Parsing error at line 7.
{if [layer_z] < 50}G1 Z50
^
!!!!! End of an error report for the custom G-code template end_gcode

Without it tells me layer_z is not a variable name:
!!!!! Failed to process the custom G-code template end_gcode
Parsing error at line 7: Not a variable name
{if layer_z < 50}G1 Z50
^
!!!!! End of an error report for the custom G-code template end_gcode

Posted : 01/03/2018 3:30 pm
HeySideburns
(@heysideburns)
Trusted Member
Topic starter answered:
Re: Trouble using conditionals in Slic3r 1.38.6-prusa3d

After some more experimentation, it seems that layer_z is only valid in the layer change fields for custom g-code, which doesn't help in my case.

Posted : 01/03/2018 4:20 pm
HeySideburns
(@heysideburns)
Trusted Member
Topic starter answered:
Re: Trouble using conditionals in Slic3r 1.38.6-prusa3d

Looking at the code on github, it only inserts calculated layer placeholders (layer_z, layer_num, current_retraction) for processing of the before and after layer custom gcode. Maybe if I get some time I'll take a stab at keeping track of the last layer height printed and maybe the max layer height printed and make those available in the end print gcode processing. Need to get my MK3 calibrated and rebuilt with the new parts first. 😆

Posted : 01/03/2018 4:36 pm
Vince Thyng
(@vince-thyng)
Active Member
Re: Trouble using conditionals in Slic3r 1.38.6-prusa3d

Ah, thank you! I had to create a custom printer with this Z change code for the temp tower so it could process the conditionals for layer_z

Posted : 26/11/2018 8:21 am
Share: