Gcode Meta commands - where to find allowed expressions ?
-
sylvain
sylvain 8 Aug 2020, 15:30Hi everybody
I'm trying to play with conditionnal gcode. I looked at this page :
https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands
Where I found for example :
if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28
Where can I found allowed expressions ? By expression I mean in this case "move.axes[x].homed" ?
Is there a dozuki page about this ?
What I want to do today is :
if "Y axis position < -45" DO SOMETHING
Thanks !
-
-
I found this :
https://duet3d.dozuki.com/Wiki/Object_Model_of_RepRapFirmware
but it seems that position state is not implemented
Thanks
-
@sylvain said in Gcode Meta commands - where to find allowed expressions ?:
but it seems that position state is not implemented
its just not documented i believe. look at he M409 command to examine your current object model and maybe search the forum for examples?
move.axes[1].userPosition
should be your y position iirc -
@bearer said in Gcode Meta commands - where to find allowed expressions ?:
move.axes[1].userPosition
Thanks for your help !
-
@bearer said in Gcode Meta commands - where to find allowed expressions ?:
@sylvain said in Gcode Meta commands - where to find allowed expressions ?:
but it seems that position state is not implemented
its just not documented i believe. look at he M409 command to examine your current object model and maybe search the forum for examples?
move.axes[1].userPosition
should be your y position iircBear in mind that userPosition is position commanded by GCode and is subject to modification by tool offsets, workplace coordinates. M579 coordinate scaling etc. Depending on what you want to do, it may be more appropriate to use move.axes[1].machinePosition.
-
@duetlover
There isn’t a lot of examples. I just cobbled this together for a temperature tower. It needs to use some Constants from the slicer and variables. I have not been able to get the Latest RRF 3.X working well yet. So, I don’t have variables yet, but hear is a Script that worked for me on layer change for the temperature tower:
;
if move.axes[2].machinePosition > 1.3 && move.axes[2].machinePosition < 1.4
echo "machinePosition=", move.axes[2].machinePosition
echo "Setting tempreture to: 240"
M104 S240
elif move.axes[2].machinePosition > 11.0 && move.axes[2].machinePosition < 11.2
echo "machinePosition=", move.axes[2].machinePosition
echo "Setting tempreture to: 245"
M104 S245
elif move.axes[2].machinePosition = 21.0 && move.axes[2].machinePosition < 21.2
echo "machinePosition=", move.axes[2].machinePosition
echo "Setting tempreture to: 250"
M104 S250
elif move.axes[2].machinePosition = 31.0 && move.axes[2].machinePosition < 31.2
echo "machinePosition=", move.axes[2].machinePosition
echo "Setting tempreture to: 255"
M104 S255
;
Sorry, keeps losing the indents