Implement G code jump function
- zhuck
 - Offline
 - New Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 4
 - Thank you received: 0
 
			
	
						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!
 			
					
	
			
			 		
													
	
				Implement G code jump function was created 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.
- HansU
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 696
 - Thank you received: 212
 
			
	
						07 May 2022 14:09				#242235
		by HansU
	
	
		
			
	
			
			 		
													
	
				Replied by HansU on topic Implement G code jump function			
			
				Why can't you use a loop instead?			
					Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						07 May 2022 21:37				#242267
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Implement G code jump function			
			
				If you just want an endless loop
linuxcnc.org/docs/stable/html/gcode/o-code.html
(but note that the G-code preview tends to get stuck in inifinite loops)
					O100 WHILE [1]
do stuff
O100 ENDWHILElinuxcnc.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.
- zhuck
 - Offline
 - New Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 4
 - Thank you received: 0
 
			
	
						09 May 2022 01:53				#242341
		by zhuck
	
	
		
			
	
			
			 		
													
	
				Replied by zhuck on topic Implement G code jump function			
			
				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.
					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.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						09 May 2022 07:56				#242361
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic Implement G code jump function			
			
				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
...
M2Please Log in or Create an account to join the conversation.
		Time to create page: 0.116 seconds