Have a gcode program that asks for a few variables before it will run, think I am dealing with them wrongly, would someone show me the correct format for these variables.
; Define variables
#1 = [Input 1] ; Diameter
#2 = [Input 2] ; Depth of cut
#3 = 0 ; Current Z position
I tried putting the value inside the square brackets & the program would not start.
should I be following the format of #3 and just put in the value?
Thanks in advance.
in G-code, variables are called parameters and you can recognize them by the leading number sign (#). Parameters can be assigned a value in the form #1 = 0 which means the parameter #1 is assigned the value 0. There exist numbered parameters, subroutine parameters, and named parameters.
#1 is an example for a subroutine parameter, as #1–#30 are used to hold the actual parameters passed to a subroutine. They are global and accessible in numbered subprograms, similar to higher-numbered parameters in traditional style calls. Modifications to these parameters within a subprogram are global modifications, and will be persist after subprogram return.
The only value type that is allowed in parameters is floating point, there are no string or integer values.
Square brackets are used to enclose expressions, which are evaluated to a number. Expressions can be numbers, parameter values, mathematical operations, and other expressions.
A valid expression would be [1+1] or [SQRT[3]]
Since in your example “[Input 1]” is no valid expression, I think the author of your code example used the square brackets not to designate an expression, but probably just as a placeholder for the real value. Therefore I would replace the “[Input 1]” by the value. In doubt ask the author what they meant with that.
More important than the knowledge you have, which is a considerable amount,
is the fact that you are willing to share your knowhow, taking the time to help we mere mortals.
Thank you.