Current units for custom GCode
-
I am composing a custom gcode and for the parameters to behave naturally, I need to know if it being executed using metric or imperial units.
I figured out I can get this from inputs[].distanceUnit but I am unclear how to determine which inputs array elements applies to the current execution of my custom gcode. Is it always inputs[0] or do I need to look up the correct index from somewhere else in the data model?
For reference, I need to know the units because I need to compare the machine position to a parameter which will be in whatever units are configured...since the machine position always comes back in metric so I need to figure out if I need to divide by 25.4 before comparing...
-
@msamblanet it's not always inputs[0]. Use the value of inputs[n].name to see which input is which.
Currently there is no way to establish which input a command is received from. I could add a variable to return the input number.
-
@dc42 I saw the name but I don't know in advance where this gcode is being called from. I could make assumptions but sooner or later that will bite me
Adding some variable for currentInputIndex (or whatever name it gets) would be perfect.
Thanks...
- M
-
@msamblanet I've added that to the wish list. If it's simple enough to implement, I may be able to include it in RRF 3.4.
-
Just FYI - this came up for me for another scenario where reading the feed rate would be nice (for trying to automating setting a rotational feed rate to provide an approx same linear tool feed rate)
-
@msamblanet I have added state.thisInput to the object model ready for the RRF 3.4.0rc1 release.
-
@dc42 Thanks! Will that be an index or the actually input object?
-
@msamblanet it will be an index.