IF statement doesn't work
27 Jun 2014 05:58 #48262
by lewac
IF statement doesn't work was created by lewac
yeah I need this and it gives the following error in 2.5.4 on an EMPTY file except for a test statement such as shown in the snippet...
IF [X EQ 1] THEN Y = 2
or you can try this:
IF [X EQ 1] Y = 2
ENDIF
or this:
IF [X EQ 1] THEN Y = 2
ENDIF
The error is totally unrelated to the statement... looks like a parsing issue. note that this parser is REALLY lax in picking up bad syntax as well. don't have the time to delve through the source so looks like a reload of the OS to return to an earlier version...
IF [X EQ 1] THEN Y = 2
or you can try this:
IF [X EQ 1] Y = 2
ENDIF
or this:
IF [X EQ 1] THEN Y = 2
ENDIF
The error is totally unrelated to the statement... looks like a parsing issue. note that this parser is REALLY lax in picking up bad syntax as well. don't have the time to delve through the source so looks like a reload of the OS to return to an earlier version...
Please Log in or Create an account to join the conversation.
27 Jun 2014 07:09 #48263
by alan_3301
Replied by alan_3301 on topic IF statement doesn't work
did that work on an earlier version?
I think if statements have to be in a O subroutine.
also I don't think axis letters are read as variables, you need to use the parameter that matches the axis.
and instead of Y=2 it should be g1 y2.
as far as I know, I may be wrong.
linuxcnc.org/docs/html/gcode/o-code.html#sec:subroutines
I think if statements have to be in a O subroutine.
also I don't think axis letters are read as variables, you need to use the parameter that matches the axis.
and instead of Y=2 it should be g1 y2.
as far as I know, I may be wrong.
linuxcnc.org/docs/html/gcode/o-code.html#sec:subroutines
Please Log in or Create an account to join the conversation.
27 Jun 2014 14:42 #48264
by Rick G
Replied by Rick G on topic IF statement doesn't work
Might want to look here...
www.linuxcnc.org/docs/2.4/html/gcode_main.html#r3_3
and
linuxcnc.org/docs/html/gcode/o-code.html
Rick G
www.linuxcnc.org/docs/2.4/html/gcode_main.html#r3_3
and
linuxcnc.org/docs/html/gcode/o-code.html
Rick G
Please Log in or Create an account to join the conversation.
27 Jun 2014 19:06 #48270
by andypugh
IF / ENDIF statements need O-numbers so that the parser can match beginnings and ends.
O100 IF {1 LT 2]
O101 IF [3 GT 4]
...
O101 ENDIF
O100 ELSE
...
O100 ENDIF
There is no THEN in G-code.
You can not assign values to XYZABCUVW. These are commands not variables.
Your sample code would never have worked in any G-code interpreter.
Replied by andypugh on topic IF statement doesn't work
yeah I need this and it gives the following error in 2.5.4 on an EMPTY file except for a test statement such as shown in the snippet..
IF / ENDIF statements need O-numbers so that the parser can match beginnings and ends.
O100 IF {1 LT 2]
O101 IF [3 GT 4]
...
O101 ENDIF
O100 ELSE
...
O100 ENDIF
There is no THEN in G-code.
You can not assign values to XYZABCUVW. These are commands not variables.
Your sample code would never have worked in any G-code interpreter.
Please Log in or Create an account to join the conversation.
Time to create page: 0.080 seconds