How to use gcode expressions with Prusa slicer
-
I am trying to add the following command to the Prusa slicer 'before layer' gcode but am getting an error because prusa slicer tries to parse it and fails.
Is there a trick for adding such commands directly in the prusa slicer?
M572 D0 S{0 + (0.002 * move.axes[2].userPosition)}
-
@zapta
TryM572 D0 S{"{0 + (0.002 * move.axes[2].userPosition)}"}
-
Thanks @owend. It works.
It significantly simplifies running test towers.
-
@zapta i am dreaming from a universal tuning macro...
Temp Tower
then
PA
then
Retract
The best would be without any help of a slicer.
-
@pcr said in How to use gcode expressions with Prusa slicer:
@zapta i am dreaming from a universal tuning macro...
Maybe something like this? The macro computes the iterator value based on the current z and append to the command prefix.
my_tower_macro( start_value, delta_per_mm, command_prefix)
Then it can be called like this from slicer's layer change code to iterate the value of C over the object height,
tunning_tower S0 D0.02 P"M123 A1 B2 C"
It is based on this Klipper snippet
TUNING_TOWER COMMAND=SET_PRESSURE_ADVANCE PARAMETER=ADVANCE START=0 FACTOR=.005
-
@pcr
I may modify the macro I did for PA to allow it to also do temp and retract.
You could pass the M code you want to tune as a parametereg. X568 to do temp or X572 to do PA.
The problem is you cant then just useM{param.X} S{param.S}
in your macro as it throws up a bad command error.
You would have to do a bunch of if statementsif param.X = 568 M568 S{param.S} elif param.X = 572 M572 S{param.S}
Still doable, and as I'm on holidays for another week I might get a chance to do so.