Echo calculated values ??
- dansawyer
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 56
 - Thank you received: 1
 
			
	
						22 Oct 2021 19:41				#223945
		by dansawyer
	
	
		
			
	
			
			 		
													
	
				Echo calculated values ?? was created by dansawyer			
			
				Is there a way for LInux cnc to echo a calculated value? Below is a snippit of code, I would like to echo the values of 'g' and 'g2' depending on changing 'd1' and 'd2';
Thank you, Dan
#<_dia> = 14.6875 ; this aligns with a 3/16 thick rolled band
#<_radius> = [#<_dia>/2]
#<_d1> = 3.02 ; This parametr sets the total length (currently 4 inches)
#<_d2> = 5.52 ; This parameter aligns the top of the arc with width
#<_theta1> = [asin[#<_d1>/#<_radius>]]
#<_theta2> = [asin[#<_d2>/#<_radius>]]
#<_g> = [#<_radius> - [cos[#<_theta1>] * #<_radius>]] ; offset to start of part
#<_g2> = [#<_radius> - [cos[#<_theta2>] * #<_radius>]] ; offset to end of part
 			
					Thank you, Dan
#<_dia> = 14.6875 ; this aligns with a 3/16 thick rolled band
#<_radius> = [#<_dia>/2]
#<_d1> = 3.02 ; This parametr sets the total length (currently 4 inches)
#<_d2> = 5.52 ; This parameter aligns the top of the arc with width
#<_theta1> = [asin[#<_d1>/#<_radius>]]
#<_theta2> = [asin[#<_d2>/#<_radius>]]
#<_g> = [#<_radius> - [cos[#<_theta1>] * #<_radius>]] ; offset to start of part
#<_g2> = [#<_radius> - [cos[#<_theta2>] * #<_radius>]] ; offset to end of part
Please Log in or Create an account to join the conversation.
- phillc54
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 5711
 - Thank you received: 2093
 
			
	
						22 Oct 2021 22:47				#223960
		by phillc54
	
	
		
			
	
			
			 		
													
	
				Replied by phillc54 on topic Echo calculated values ??			
			
				from gcode you could use debug(18) or print(19)
linuxcnc.org/docs/2.8/html/gcode/overview.html#gcode:debug
					linuxcnc.org/docs/2.8/html/gcode/overview.html#gcode:debug
Please Log in or Create an account to join the conversation.
- dansawyer
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 56
 - Thank you received: 1
 
			
	
						23 Oct 2021 17:18				#224004
		by dansawyer
	
	
		
			
	
			
			 		
													
	
				Replied by dansawyer on topic Echo calculated values ??			
			
				I tried the following however it did print anything.
#<_g1> = [#<_radius> - [cos[#<_theta1>] * #<_radius>]] ; offset to start of part
#<_g2> = [#<_radius> - [cos[#<_theta2>] * #<_radius>]] ; offset to end of part
o1 ; Main program 1
(print,g1 = #<_g1>)
(print,g2 = #<_g2>)
					#<_g1> = [#<_radius> - [cos[#<_theta1>] * #<_radius>]] ; offset to start of part
#<_g2> = [#<_radius> - [cos[#<_theta2>] * #<_radius>]] ; offset to end of part
o1 ; Main program 1
(print,g1 = #<_g1>)
(print,g2 = #<_g2>)
Please Log in or Create an account to join the conversation.
- phillc54
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 5711
 - Thank you received: 2093
 
			
	
						23 Oct 2021 22:27				#224038
		by phillc54
	
	
		
			
	
			
			 		
													
	
				Replied by phillc54 on topic Echo calculated values ??			
			
				For print to work you need to stat LinuxCNC from a terminal, then the result will be printed to the terminal. debug will make it appear in a popup message in the Axis GUI.
this worked for me:			
					this worked for me:
#<_radius> = 20
#<_theta1> = 2
#<_theta2> = 3
#<_g1> = [#<_radius> - [cos[#<_theta1>] * #<_radius>]] ; offset to start of part
#<_g2> = [#<_radius> - [cos[#<_theta2>] * #<_radius>]] ; offset to end of part
(debug,g1 = #<_g1>)
(debug,g2 = #<_g2>)
M2Please Log in or Create an account to join the conversation.
- dansawyer
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 56
 - Thank you received: 1
 
			
	
						24 Oct 2021 01:34				#224057
		by dansawyer
	
	
		
			
	
			
			 		
													
	
				Replied by dansawyer on topic Echo calculated values ??			
			
				Yes. That worked. Thank you. Dan			
					Please Log in or Create an account to join the conversation.
		Time to create page: 0.082 seconds