No 'GOTO', use 'if' instead?

More
10 Aug 2017 10:50 #97277 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

Please Log in or Create an account to join the conversation.

More
11 Aug 2017 13:10 #97341 by andypugh
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

Please Log in or Create an account to join the conversation.

More
11 Aug 2017 13:49 #97343 by AlbertHall
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.

Please Log in or Create an account to join the conversation.

Time to create page: 0.133 seconds
Powered by Kunena Forum