×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-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.

Students Click Here

Jobs

TCL string operations

TCL string operations

TCL string operations

(OP)
Is it possible to make the postprocessor to analyze the symbols in string and change them if needed? For example:
source string: "THIS_IS_AN_EXAMPLE"
produced string: "THIS IS AN EXAMPLE"
As you see, the underscore is changed to space.

BTW. How to output in the end of the program the very first tool which was used there in the program? MOM_first_tool puts only the last operation's tool.

 

RE: TCL string operations

Text string is the variable of the string you are trying to change and the last is the name of the string var that you want to put the changed string in. In this example it is the same var. That should work.

regsub -all {_} $text_string " " text_string

RE: TCL string operations

Hi
  To get 1st tool at the end I would do something like this
In MOM_start_of_program
  global i0wa_first_tool_change

  set i0wa_first_tool_change 0

In MOM_first_tool
  global i0wa_first_tool_change
  global i0wa_first_tool
  global mom_tool_number

  if {i0wa_first_tool_change == 0} {
    set i0wa_first_tool $mom_tool_number
    set i0wa_first_tool_change 1
  }

You could also use mom_tool_name
Then just declare and output i0wa_first_tool where required.
Be careful that any custom variables are unique. I add AED_ in front of all my variables to ensure they are.
Hope That Helps

Cheers
  Steve Griffiths smile

If you want to make apple pie from scratch, first you must create the universe!

RE: TCL string operations

(OP)
Sounds like a plan ;)

RE: TCL string operations

(OP)
Thank You for Your posts!

RE: TCL string operations

I thought there was a variable called mom_first_tool or something like that.

RE: TCL string operations

No there is not a variable called that but you could just try mom_next_tool_number as this would be the next tool #.

RE: TCL string operations

I just checked and it worked on my post. I just put a tool change block in the end of program that has the T defined as next tool and it will see the next as the first in the program.

RE: TCL string operations

(OP)
MOM_first_tool is a process not a variable.
Question to <b>shags72</b>:
Your solution works perfect, thank You very much!
But could You also say what code of symbol "-" (minus) because if I try to change underscore to minus then I get an error in
regsub -all {_} $text_string " " text_string bla-bla-bla, that "-" is used incorrectly.

BTW (as always, offtop) it seems that there is no problem to get the machining time in the end of the program, but what about getting the machining time in the very beginning? is it possible?

PS I am very sorry for my bad English.

RE: TCL string operations

Put a \ in front of the _ like this \_. \ is an escape character. To put times at the start of output you must write them to another file and then close your output file and rewrite to a temp file, first writing your times to it and then your  output to it. Then you close both and delete your original output file and rename your temp to your original name. There are examples of this in the gtac forum. If you have a license for NX you can use your sold to id to get a login at this site and then gtac site is next link.

http://ftp.ugs.com/

http://bbs.industrysoftware.automation.siemens.com//vbulletin/forumdisplay.php?f=90

RE: TCL string operations

(OP)
To create temp file, then final is the common way. There is custom command like "initialize tool list" used for tool list generation in before than any tool is used - another words in the program start. what about this?

RE: TCL string operations

(OP)
Sorry, it's impossible to get machine time as I suggested.. I read comments and.. temp file then re-posting again is the only possible way.

RE: TCL string operations

I think if you just open your temp file for writing at the end and then write your output to it, then delete original output and rename your time file to output name that this will work.

RE: TCL string operations

Oh and also you would need to check to see if the file name exists and if it does delete it.

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 Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources