No 'GOTO', use 'if' instead?
- AlbertHall
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 30
- Thank you received: 0
10 Aug 2017 10:50 #97277
by AlbertHall
No 'GOTO', use 'if' instead? was created by AlbertHall
Is this legal code for Linuxcnc and is its effect to skip the lines between the 'if' and the 'endif' lines?
M05
G0 G53 Z40
G0 G53 X190 Y0
O100 if [2 GT 5] (always false condition)
G00 Z2.0000
G00 Z20.0000
M05
O100 endif
M02
M05
G0 G53 Z40
G0 G53 X190 Y0
O100 if [2 GT 5] (always false condition)
G00 Z2.0000
G00 Z20.0000
M05
O100 endif
M02
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23323
- Thank you received: 4948
11 Aug 2017 13:10 #97341
by andypugh
Replied by andypugh on topic No 'GOTO', use 'if' instead?
Yes, that is legal.
More common would be "O100 WHILE [0]"
But, if you don't want to run the lines, why not delete them?
If you want them optional, look at "block delete":
linuxcnc.org/docs/2.7/html/gcode/overview.html#_block_delete
More common would be "O100 WHILE [0]"
But, if you don't want to run the lines, why not delete them?
If you want them optional, look at "block delete":
linuxcnc.org/docs/2.7/html/gcode/overview.html#_block_delete
Please Log in or Create an account to join the conversation.
- AlbertHall
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 30
- Thank you received: 0
11 Aug 2017 13:49 #97343
by AlbertHall
Replied by AlbertHall on topic No 'GOTO', use 'if' instead?
Thanks for your answer and while[0] looks better.
As to why I would do this, I use PCBgcode which produces gcode to mill PCBs but it includes stuff that I don't want. PCBgcode has a mechanism to include lines of user gcode at user selected places so I can use this mechanism to automatically skip the parts I don't need rather than having to manually delete them every time.
As to why I would do this, I use PCBgcode which produces gcode to mill PCBs but it includes stuff that I don't want. PCBgcode has a mechanism to include lines of user gcode at user selected places so I can use this mechanism to automatically skip the parts I don't need rather than having to manually delete them every time.
Please Log in or Create an account to join the conversation.
Time to create page: 0.139 seconds