@dc42 Thanks! Will that be an index or the actually input object?
Posts made by msamblanet
-
RE: Current units for custom GCode
-
RE: Current units for custom GCode
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)
-
RE: Array parameters for custom gcode
@dc42 - By any chance have you had a chance to look at my sample above showing the issue?
-
RE: Array parameters for custom gcode
@dc42 I just reran some tests and this is what I got - I made a simple custom G999 that echos data about the X parameter...X never seems to be an array. I tried all of the various calling conventions listed in that link:
;;; sys/G999.g
echo "; param.X: ", param.X
echo "; #param.X: ", #param.X
echo "; param.X[0]: ", param.X[0]
echo "; param.X[1]: ", param.X[1];;; Console
1/16/2022, 2:51:25 PM
G999 X{7:8}
; param.X: null
; #param.X: null
Error: in file macro line 4 column 34: meta command: unknown parameter 'X^'1/16/2022, 2:51:08 PM
G999 X5:6
; param.X: 5
; #param.X: 5
Error: in file macro line 4 column 34: meta command: unknown parameter 'X^'1/16/2022, 2:51:01 PM
G999 X{3}:{4}
; param.X: 3
; #param.X: 3
Error: in file macro line 4 column 34: meta command: unknown parameter 'X^'1/16/2022, 2:50:51 PM
G999 X{1,2}
; param.X: null
; #param.X: null
Error: in file macro line 4 column 34: meta command: unknown parameter 'X^' -
RE: Array parameters for custom gcode
@dc42 I saw that but my challenge is passing them to a custom gcode script. I can’t seem to read anything but the first value.
I don’t have my test code with me - the cnc machine is at my friends house and not mine - I’m the code guy :). I’ll get specific tests and results and post them here. From memory my examples looks like this:
;;; macros/test.g
M910 X{1,2,3}
; M910 X1:2:3;;;sys/M910.g
echo param.X
echo param.X[0]
echo param.X[1]
echo #param.XIf I remember correctly, I never got anything other than the first X value. Depending on syntax, exact results and errors varied.
I’ll try to get and post precise data later today.
Thanks
- M
-
Array parameters for custom gcode
Is it possible to pass an array parameter to a custom gcode? I want to do something like:
G910 X1:2:3
But the best I have been able to do is get the first value - I never seem to get an array in param.X…
I searched around but could not seem to find any examples of doing this…
Also a big thanks to everybody on the RRF team. I’ve been helping a friend write custom macros and we are managing some cool CNC stuff with the meta scripting. Not too advanced yet but working our way up to cooler things (I’d say bigger but his hobby is 1/4 scale furniture )…
- M
-
RE: Current units for custom GCode
@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
-
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...