if commands in linux
- foam man
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 61
- Thank you received: 3
			
	
						27 Sep 2022 04:25				#252828
		by foam man
	
	
		
			
	
			
			 		
													
	
				if commands in linux was created by foam man			
			
				i need to use the If function
heres what id like to do
#<code>= 6
#<flange>= #<code>
#<flangedp>= #<code>
if #<code>= to 6 then #<flange>= 2 and #<flangedp>=.25
if #<code>= to 4 then #<flange>= 1.5 and #<flangedp>=.125
G1 x .5
G1 Y- #<flange>
i know this is not the correct way to write this, but i'm wondering if this scenario is even possible
					heres what id like to do
#<code>= 6
#<flange>= #<code>
#<flangedp>= #<code>
if #<code>= to 6 then #<flange>= 2 and #<flangedp>=.25
if #<code>= to 4 then #<flange>= 1.5 and #<flangedp>=.125
G1 x .5
G1 Y- #<flange>
i know this is not the correct way to write this, but i'm wondering if this scenario is even possible
Please Log in or Create an account to join the conversation.
- Aciera
- 
				  
- Offline
- Administrator
- 
				  
		Less
		More
		
			
	
		- Posts: 4554
- Thank you received: 2028
			
	
						27 Sep 2022 07:18		 -  27 Sep 2022 07:22		#252832
		by Aciera
	
	
		
			
	
	
			 		
													
	
				Replied by Aciera on topic if commands in linux			
			
				Have you found the documentation regarding GCODE in LinuxCNC ? :
linuxcnc.org/docs/html/gcode/overview.html
Also sound like you may want to have a look at the O codes documentation:
linuxcnc.org/docs/html/gcode/o-code.html
You will find an example of conditional gcode in the above documentation (section 3)
					linuxcnc.org/docs/html/gcode/overview.html
Also sound like you may want to have a look at the O codes documentation:
linuxcnc.org/docs/html/gcode/o-code.html
You will find an example of conditional gcode in the above documentation (section 3)
		Last edit: 27 Sep 2022 07:22  by Aciera.		Reason: add link to o codes	
			Please Log in or Create an account to join the conversation.
- mgm
- 
				  
- Offline
- Elite Member
- 
				  
		Less
		More
		
			
	
		- Posts: 210
- Thank you received: 13
			
	
						27 Sep 2022 07:25				#252834
		by mgm
	
	
		
			
	
	
		
			
			 		
													
	
				Replied by mgm on topic if commands in linux			
			
				Aciera was faster ..... the example in the attachment I use for drilling for holes considering the length of a rail 
 
			
					Attachments:
Please Log in or Create an account to join the conversation.
- foam man
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 61
- Thank you received: 3
			
	
						29 Sep 2022 04:01				#252987
		by foam man
	
	
		
			
	
			
			 		
													
	
				Replied by foam man on topic if commands in linux			
			
				thanks to both of you
your help is appreciated
so i wrote the following
Linux does not complain about it, but doesn't really run it either
the computer running the machine is pretty small and I'm wondering if that is the problem
Any ideas?
%
(#<TBcode>= 66) ( enter top&bottom code)
#<LRcode>= 46 ( enter left&right code)
#<Lflange>=1
#<Lflangedp>=1
#<Rflange>=1
#<Rflangedp>=1
o101 if [#<LRcode> EQ 66]
#<Lflange>= 1.5
#<Lflangedp>= .25
#<Rflange>=1.5
#<Rflangedp>=.25
o101 elseif [#<LRcode> EQ 64]
#<Lflange>= 1.5
#<Lflangedp>=.25
#<Rflange>=2
#<Rflangedp>=.5
o101 elseif [#<LRcode> EQ 46]
#<Lflange>= 2
#<Lflangedp>= .5
#<Rflange>=1.5
#<Rflangedp>=.25
o101 elseif [#<LRcode> EQ 00]
#<Lflange>= 0
#<Lflange> 0
#<Rflange>=0
#<Rflangedp>=0
G91
g1y 20
g1x- #<Rflange>
g1y #<Rflangedp>
g1x- 40
g1y- #<Lflangedp>
g1x- #<Lflange>
g1y- 20
g1x #<Lflange>
g1y- #<Lflangedp>
g1x 40
g1y #<Rflangedp>
g1x #<Rflange>
%
					your help is appreciated
so i wrote the following
Linux does not complain about it, but doesn't really run it either
the computer running the machine is pretty small and I'm wondering if that is the problem
Any ideas?
%
(#<TBcode>= 66) ( enter top&bottom code)
#<LRcode>= 46 ( enter left&right code)
#<Lflange>=1
#<Lflangedp>=1
#<Rflange>=1
#<Rflangedp>=1
o101 if [#<LRcode> EQ 66]
#<Lflange>= 1.5
#<Lflangedp>= .25
#<Rflange>=1.5
#<Rflangedp>=.25
o101 elseif [#<LRcode> EQ 64]
#<Lflange>= 1.5
#<Lflangedp>=.25
#<Rflange>=2
#<Rflangedp>=.5
o101 elseif [#<LRcode> EQ 46]
#<Lflange>= 2
#<Lflangedp>= .5
#<Rflange>=1.5
#<Rflangedp>=.25
o101 elseif [#<LRcode> EQ 00]
#<Lflange>= 0
#<Lflange> 0
#<Rflange>=0
#<Rflangedp>=0
G91
g1y 20
g1x- #<Rflange>
g1y #<Rflangedp>
g1x- 40
g1y- #<Lflangedp>
g1x- #<Lflange>
g1y- 20
g1x #<Lflange>
g1y- #<Lflangedp>
g1x 40
g1y #<Rflangedp>
g1x #<Rflange>
%
Please Log in or Create an account to join the conversation.
- Aciera
- 
				  
- Offline
- Administrator
- 
				  
		Less
		More
		
			
	
		- Posts: 4554
- Thank you received: 2028
			
	
						29 Sep 2022 06:54				#252996
		by Aciera
	
	
		
			
	
			
			 		
													
	
				Replied by Aciera on topic if commands in linux			
			
				Local parameters are only visible (ie usable) inside the subroutine, see section 3 - Scope:
linuxcnc.org/docs/html/gcode/overview.html#_named_parameters
Missing: o101 endif
G1 move requires a feedrate.
So here is a suggestion (You might want to move to a defined position before calling the subroutine ie before o100 call):
			
					linuxcnc.org/docs/html/gcode/overview.html#_named_parameters
Missing: o101 endif
G1 move requires a feedrate.
So here is a suggestion (You might want to move to a defined position before calling the subroutine ie before o100 call):
o100 sub
    #<Lflange>=1
    #<Lflangedp>=1
    #<Rflange>=1
    #<Rflangedp>=1
    (#<TBcode>= 66) ( enter top&bottom code)
    #<LRcode>= 46( enter left&right code)
    o101 if [#<LRcode> EQ 66]
        #<Lflange>= 1.5
        #<Lflangedp>= .25
        #<Rflange>=1.5
        #<Rflangedp>=.25
    o101 elseif [#<LRcode> EQ 64]
        #<Lflange>= 1.5
        #<Lflangedp>=.25
        #<Rflange>=2
        #<Rflangedp>=.5
    o101 elseif [#<LRcode> EQ 46]
        #<Lflange>= 2
        #<Lflangedp>= .5
        #<Rflange>=1.5
        #<Rflangedp>=.25
    o101 elseif [#<LRcode> EQ 00]
        #<Lflange>= 0
        #<Lflange>= 0
        #<Rflange>=0
        #<Rflangedp>=0
    o101 endif
    g1 y20
    g1 x -#<Rflange>
    g1 y #<Rflangedp>
    g1 x-40
    g1 y -#<Lflangedp>
    g1 x -#<Lflange>
    g1 y-20
    g1 x #<Lflange>
    g1 y -#<Lflangedp>
    g1 x 40
    g1 y #<Rflangedp>
    g1 x #<Rflange>
o100 endsub
G91
F300
o100 call
M2
Please Log in or Create an account to join the conversation.
- foam man
- Offline
- Senior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 61
- Thank you received: 3
			
	
						07 Oct 2022 02:21				#253642
		by foam man
	
	
		
			
	
			
			 		
													
	
				Replied by foam man on topic if commands in linux			
			
				thanks guys it looks like it worked
I realized too late though that I can't use the I J or R command to make circles when in 4 axis mode XYZA
is it possible to do this?
					I realized too late though that I can't use the I J or R command to make circles when in 4 axis mode XYZA
is it possible to do this?
Please Log in or Create an account to join the conversation.
		Time to create page: 0.187 seconds	
