Implement G code jump function

More
07 May 2022 11:25 #242228 by zhuck
 
Hello everyone:
LinuxCNC G code has no function to jump to a specific line.
such as G25 of some CNC manufacturers.
N10 G01 X10 F10
N20 G01 Y10 F20
N30 G25 N10
N40 G01 Z10 F20
Jump to N10 when executing to N30

How to realize the function of jumping to the specified line?
Need everyone's help, thanks!
 

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

More
07 May 2022 14:09 #242235 by HansU
Why can't you use a loop instead?

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

More
07 May 2022 21:37 #242267 by andypugh
If you just want an endless loop
O100 WHILE [1]
do stuff
O100 ENDWHILE

linuxcnc.org/docs/stable/html/gcode/o-code.html

(but note that the G-code preview tends to get stuck in inifinite loops)

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

More
09 May 2022 01:53 #242341 by zhuck
Hi, thanks for your suggestion, I will try the loop way.

I will improve the Gcode content. The usage scenarios are mainly used for conditional jumps.
For example G code:
N10 G01 X10 F10
N20 G01 Y10 F20
N30 if [#1 ET 5 ] G25 L100 endif
N40 G01 Z10 F20
...
N100 G01 U 10 F20
...
M2

When the program satisfies this N30 conditional program, it will transfer its designated block N100.

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

More
09 May 2022 07:56 #242361 by andypugh
In LinuxCNC (and anything else using NIST-standard G-code) you do this with:
N10 G01 X10 F10
N20 G01 Y10 F20
O100  if [#1 NE 5 ]
   N40 G01 Z10 F20
   ...
O100  ENDIF
N100 G01 U 10 F20
...
M2

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

Time to create page: 0.162 seconds
Powered by Kunena Forum