supermerill / SuperSlicer

G-code generator for 3D printers (Prusa, Voron, Creality, etc.)
4.13k stars 520 forks source link

Conditional G-code in Start G-code not working #1045

Closed KoeRt888 closed 3 years ago

KoeRt888 commented 3 years ago

Version

Version 2.3.55.5

Operating system type + version

Windows 10 19042.870

3D printer brand / version + firmware version (if known)

Creality CR6-SE with the most current klipper ans SKR CR6

Behavior

When trying to create a start G-Code that takes the first-layer temperature to determine if a Klipper Macro for ABS or PLA should be called the expression does not evaluate correctly. I then took the example conditional code from the slic3r documentation, found here, and pasted that in the start g-code area which resulted in the same error as my own conditional, Parsing error at line 1. Expecting a boolean expression.. The expression was {if [layer_num] == 10}M104 S210. My conditional is similar and just checks if the first-layer temperature is higher than a constant like this: {if [first_layer_bed_temperature] >= 70}.

Assuming the conditional g-code is possible, like slic3r documentation suggests, this should evaluate without error for both exressions.

neophyl commented 3 years ago

This expresses {if first_layer_bed_temperature[0] >= 70} M300 S40 P10{endif} ;chirp

The clue was in the error message, about accessing a vector variable when a scalar one is expected. The prusa knowledge base article for this is at https://help.prusa3d.com/en/article/macros_1775
it says - and elements of vector variables can be accessed by using square braces temperature[0] as temperature was the example given and given that the error message implies its a vector variable adding the [0] was the logical thing to try.

Given that Super Slicer is built upon PS then it makes sense to check the PS knowledge base and wiki's first rather than Slic3r which while much is still the same , much is not.