Cura strips indents from conditional G code
-
Just a heads up for anyone playing with conditional g code.
Cura strips leading spaces and tab indents from the start & end G code when you close the program.
So it’ll work fine when you test it, but next time you open Cura all the indents will be gone, so all commands will be executed.
e.g the example ofif !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28 // rest of start code
will become after restarting Cura
if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28
Causing G28 to be called regardless of how the IF statement evaluates.
-
move the code to a macro and call the macro
-
This is a good case for using the start.g macro which runs when a print is started before any of the sliced gcode file is executed.
-
@OwenD, this justified a bug report or feature request (e.g. hard space) from Cura. Saving operation modifying the settings is bad.
-
Oops. Forgot HTML would strip the spaces as well.
It was late. LOLYes you can easily use a macro.
Just remember that if the slicers doesn’t see some settings in the start code, it will automatically add them, so you may still not get the results you planned.It’s going to take a while for the slicers you align with the new features.
As I said, just a heads up. -
@OwenD said in Cura strips indents from conditional G code:
Oops. Forgot HTML would strip the spaces as well.
put ``` on a line over and below the code to keep the formatting here
like so
-
@bearer
-
@zapta Has been submitted
https://github.com/Ultimaker/Cura/issues/7056 -
@OwenD, very good. Thanks.