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
-
@msamblanet yes you can pass multiple values where a GCode parameter needs them. See https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Use_of_expressions_within_GCode_commands.
-
@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
-
@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^' -
@dc42 - By any chance have you had a chance to look at my sample above showing the issue?