Hello everybody,
I am CAD CAM programmer and learning tcl. For programming using Siemens NX 7.5.
I am trying write a procedure in tcl language which will do calculation in coordinate system and output a hole depth.
I manage to write it in excel , but cant do it in TCL
I excel I am using entry and exit coordinates of hole as it shown on attachment.
Formula in excel look like this:
=SQRT(POWER(D3-G3,2)+POWER(E3-H3,2)+POWER(F3-I3,2))
Where
D3= X start position of the hole
G3= X exit position of the hole
E3= Y start position of the hole
H3= Y exit position of the hole
F3= Z start position of the hole
I3= Z exit position of the hole
(Formula from excel is in attachment hole depth calculator)
In tcl I have available globals, variables:
global mom_cycle_rapid_to_pos(0) (X Start of the hole)
global mom_cycle_rapid_to_pos(1) (X Start of the hole)
global mom_cycle_rapid_to_pos(2) (X Start of the hole)
global mom_cycle_feed_to_pos(0) (X End of the hole)
global mom_cycle_feed_to_pos(1) (X End of the hole)
global mom_cycle_feed_to_pos(2) (X End of the hole)
and tried translate excel to tcl like this and it didn't work....
set H [expr{pow($mom_cycle_rapid_to_pos(0)-pow($mom_cycle_feed_to_pos(0),2),2)+
pow($mom_cycle_rapid_to_pos(1)-pow($mom_cycle_feed_to_pos(1),2),2) +
pow($mom_cycle_rapid_to_pos(2)-pow($mom_cycle_feed_to_pos(2),2),2}]
Goal is to do this calculation and output something like H= hole depth 21.84 in out first example.
I think for you guys it will be very simple.
please contact with me on segama@interia.pl
or post code here.
I am CAD CAM programmer and learning tcl. For programming using Siemens NX 7.5.
I am trying write a procedure in tcl language which will do calculation in coordinate system and output a hole depth.
I manage to write it in excel , but cant do it in TCL
I excel I am using entry and exit coordinates of hole as it shown on attachment.
Formula in excel look like this:
=SQRT(POWER(D3-G3,2)+POWER(E3-H3,2)+POWER(F3-I3,2))
Where
D3= X start position of the hole
G3= X exit position of the hole
E3= Y start position of the hole
H3= Y exit position of the hole
F3= Z start position of the hole
I3= Z exit position of the hole
(Formula from excel is in attachment hole depth calculator)
In tcl I have available globals, variables:
global mom_cycle_rapid_to_pos(0) (X Start of the hole)
global mom_cycle_rapid_to_pos(1) (X Start of the hole)
global mom_cycle_rapid_to_pos(2) (X Start of the hole)
global mom_cycle_feed_to_pos(0) (X End of the hole)
global mom_cycle_feed_to_pos(1) (X End of the hole)
global mom_cycle_feed_to_pos(2) (X End of the hole)
and tried translate excel to tcl like this and it didn't work....
set H [expr{pow($mom_cycle_rapid_to_pos(0)-pow($mom_cycle_feed_to_pos(0),2),2)+
pow($mom_cycle_rapid_to_pos(1)-pow($mom_cycle_feed_to_pos(1),2),2) +
pow($mom_cycle_rapid_to_pos(2)-pow($mom_cycle_feed_to_pos(2),2),2}]
Goal is to do this calculation and output something like H= hole depth 21.84 in out first example.
I think for you guys it will be very simple.
please contact with me on segama@interia.pl
or post code here.