retrieve the Position of an axis



  • Hello guys,

    is there an option to get the position of an axis as an actual value. In the object model there is a parameter called machinePosition (in the Move part) but I cant'get it.

    What I like to do (attention pseudo code):
    G1 Z{postion[U]+30}

    Is something like this possible?

    Thank you!



  • @taconite said in retrieve the Position of an axis:

    What I like to do (attention pseudo code):
    G1 Z{postion[U]+30}

    G91               ; relative positioning
    G0Z30             ; move Z 30mm
    G90               ; absolute positioning
    


  • if you insist on using conditional g-code you can do

    G90
    G0 Z{move.axes[2].userPosition + 30}
    

    but I'm not sure why would you do it, that's why the relative positioning exist



  • I might expand on @arhi's input and use push and pop just to ensure no undesired side effects from using relative moves.

    M120              ;push 
    G91               ; relative positioning
    G0Z30             ; move Z 30mm
    M121              ;pop
    

    That said, i think it would be possible to use move.axes[.... and he beat me to it again 👍



  • @arhi @bearer
    so I tried my luck with: move.axes[3].machinePosition but the addition did not work.

    The use case is that at a certain point in a tool change macro the Z axis needs to be relative to the U axis (that's why I want to set the Position of the Z axis X mm (e.g. 30mm) from the U axis (because they have and have to have different homing positions).

    So after your suggestions I tried G1 Z{move.axes[3].userPosition+30} and now it is perfectly working.

    Thank you guys - you are the best!!!



  • and again another object model question 🐒

    I would like to get the current status of the z-probe for an if statement

    I can find it in the object model:
    M409 K"sensors.probes[0].value"
    {"key":"sensors.probes[0].value","flags":"","result":[1000]}

    but when I try to echo the signal
    echo sensors.probes[0].value
    [array]

    I don't get the information I would like to have (whether it is 0 (not triggered) or 1000 (triggered). Could you please once more help me - thank you in advance!!

    Okay never mind!
    echo sensors.probes[0].value[0] did the job!


Log in to reply