×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

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

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

(OP)
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.

or post code here.

Replies continue below

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

I think you may have the wrong forum. This is a technical forum for the UCx Voice server platform.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!