Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

VBA macro for renaming multiple operations

Status
Not open for further replies.

kyleb77

Aerospace
Jul 26, 2006
15
0
0
US
I am completely new to VBA but can anyone post code that will simply search the Operation Navigator for a specific piece of text, and then give me a dialog box where I can replace that text with whatever I want. Basically I have a bunch of operations that I need renamed but doing this manually would take an eternity. Any help would be great!
 
Replies continue below

Recommended for you

Thanks very much but I am kind of leary to download that file. If possible can u post just the code? Also do you have a link that shows new features of NX7. Nice to see that feature implemented.
 
To run the journal go to Tools -> Journal -> Play... then use the dialog box to navigate to where you saved the file and press Run.
 
A reminder - First select the operations you want to rename. You can select the first one, then shift-select the last one to pick them all.

Then run the program as stated before.

Mark Rief
Product Manager
Siemens PLM
 
Thanks very much it works perfectly!! So is the journal application new to UG and is this the app used to run just VB scripts? I will soon be taking a VB class. Very interesting stuff..
 
In the old days, we had macros, Grip, user function. Today we use the .net framework as the API for NX. There are lots of technical details I can't explain, like using different languages, but at the basic level, you can use vb.

A journal is just a basic vb program.
You can record and play journals - like super-macros. This is similar to vba in MS Office applications. If you do this a lot, turn on the Journal tool bar.

You can also write or edit a journal to do more advanced things like this one does. IT uses functions to ask for old and new text, cycle through all the selected objects, and rename them. This is where your vb class will help.

There are several examples in the installation in the folder UGOPEN/SampleNXOpenApplications.

That should be enough to get you going :*)

Mark Rief
Product Manager
Siemens PLM
 
Thanks Mark! I did learn a lot from you...
Could you please give me some instructions about how to debug this code in NX when I try to add some new operations manaually in one recorded .vb file? Any comments will be appreciated,thanks.

Michael

Thanks
 
Status
Not open for further replies.
Back
Top