Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCL command in Siemens NX 7.5. Translation from excel to tcl.

Status
Not open for further replies.

segama

Programmer
Aug 12, 2015
1
GB
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_ejkhn9.jpg


(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}]

stuff_from_post_momiig.jpg


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 think you may have the wrong forum. This is a technical forum for the UCx Voice server platform.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top