Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Renaming Several Expressions

Status
Not open for further replies.

rdarnitall

Automotive
Aug 19, 2014
3
I have searched the forum and although I have found the link about renaming expressions to remove the hash marks, I don't believe it really achieves my goal, so please pardon me if I am wrong about that.
I have a NX8.5 start part that contains a Feature Group that is copied and pasted into other part files. The Feature Group brings with it, about 45 expressions that are used to drive sketches. The expression names all use an arbitrary number (99), that is intended to make it obvious to the user that the values have not been updated.(ex. feature_99_dia, feature_99_length, etc.). I am exporting a .exp file from an Excel spreadsheet that contains corresponding expression names and values, but the number in the expression names are defined by a value in the spreadsheet, (ex. feature_5_dia, feature_5_length, etc.). I will have several exported .exp files, each with a different number in the expression names, and I may use more than one of them to drive different Feature Group sketches in a single part.
My current process is for the user to copy the feature group from the start part, paste it into their part file (re-associating as necessary), rename the expressions to the number matching their .exp file, and then import the .exp file to update the values of the expressions and thus the 3D part. The problem is that manually renaming 45 expressions is time consuming and error prone. I would like to simplify/automate this by letting the user simple specify what their desired feature number is. I am open to doing this either in the start part before the copy or in their part after pasting.
Can anyone help me out with a method to do this?
 
Replies continue below

Recommended for you

A UDF is pretty much copying and pasting a feature group. your issue might be that the expression names seem to come in as your last p number. I believe that NX does that so that you don't have duplicate expressions. I don't copy features very often, but if the expressions come in as feature_99_dia, feature_99_length, etc for you then you probably need to make a journal to rename your expressions from 99 to something else.
 
Thanks for the responses!

aluminum2, the expression names come in just as I have them named in the file that contains the Feature Group and that is what I want. Since the intent is to instantiate the Features multiple times, I used the "99" just to make it obvious to anyone looking at the file, that they had not been updated. However, every part that I instantiate it into will need to be renumbered to match the project determined feature designation.
Your suggestion for using a journal worked great! However, it was very specific for renaming the expressions to the number I chose for that specific file. So, what I did after recording the journal was edit it to prompt the user for the number currently used in the expression name, (99 by default), and store that as a value, and then prompt them for what they want the new number to be and store that as a value. I then used those Dim's in the code when it selects and renames each expression. This makes it very flexible to be used over and over and it can also be used to rename files that have already been renamed to something other than names containing "99".
The only issue I have right now is that it is "hard coded" for specific expression names. Eventually I would like to edit it to look for any expression names containing a user input string and replace that string with a new value input by the user. That way if someone has added new expressions containing that number or string, it will change them all, and not fail if a specified expression name is not found, as it does now.
Thanks for the suggestion. I had not used journals before, so I hadn't thought of that as an option.

***** As a side note, I tried the same exercise recording a macro instead of a journal, and the macro was much, much larger and more difficult to find what needed to be edited than the .vb journal was.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor