×
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

VBA macro for renaming multiple operations

VBA macro for renaming multiple operations

VBA macro for renaming multiple operations

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

RE: VBA macro for renaming multiple operations


You can go to UGAnswer on ugs support web site and search for 'list operations'.  You will find GTAC example showing you how to get the operation names.  Tweak this code to achieve what you want.

Suresh
www.technisites.com.au

RE: VBA macro for renaming multiple operations

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

RE: VBA macro for renaming multiple operations

It's just a text file, download the code and open it in notepad to see the source.

RE: VBA macro for renaming multiple operations

(OP)
Thanks, I recieved file. Can you tell me how to run it within UG?

RE: VBA macro for renaming multiple operations

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.

RE: VBA macro for renaming multiple operations

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

RE: VBA macro for renaming multiple operations

Actually, if you want everything, just pick the very top node in the Operation Navigator, like NC_PROGRAM.

RE: VBA macro for renaming multiple operations

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

RE: VBA macro for renaming multiple operations

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

RE: VBA macro for renaming multiple operations

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
 

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