- Posts: 56
- Thank you received: 0
Echo calculated values ??
5 years 1 week ago #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 to join the conversation.
5 years 1 week ago #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 to join the conversation.
5 years 1 week ago #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 to join the conversation.
5 years 1 week ago #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:
Code:
#<_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>)
M2
Please Log in to join the conversation.
Time to create page: 0.114 seconds
