Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How to run a *.macro file from the menu file (*.men)? 1

Status
Not open for further replies.

jimex

Mechanical
Sep 1, 2008
6
Hello,

I have the problem to run *.macro file from my menu file.
Below I have pasted a part of code from the *.men file.

BUTTON my_button
LABEL My Button
ACTIONS $UGII_GROUP_DIR\macro\button.macro

What should be the format?

Regards
Jim
 
Replies continue below

Recommended for you

Is there any particular reason why you are using Menufiles rather than using Customize, then saving a Role which can be shared with others?

But that being said, the word is:

ACTION, not ACTIONS.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
John,

If I change ACTIONS to ACTION, UG won't run the menu file. I use Menu file, because I would like to share it with others.

Jim
 
Have you tried replacing the '$UGII_GROUP_DIR' with the actual full path just to make sure that it works?

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
John,

It is the same situation. I have tried replacing with the full path but it do not work.
 
OK, after trying this myself and even replacing the Macro with a GRIP program just to make sure that the menufile was actually being properly recognized (which it was), I decided to go back and read the documentation in a little more detail and low & behold, I uncovered something that I honestly was NOT aware of, which I've since had confirmed by the development leader responsible for this area of NX, because I was a bit amazed myself.

I'm sorry to have to inform you that Menufiles (AKA, MenuScripts) do NOT support Macros!

While it's true that the documentation does not explicitly caveat that limitation, it also does not mention Macros when you look at the list of supported ACTIONS (and you're correct, in a Menufile the word is ACTIONS, while in the toolbar files it's ACTION - go figure).

If you still think that Menufiles is way to go for your situation, you will need to replace your Macro(s) with Journal files, as they are supported.

Now, if for nothing else than perhaps for the irony value, it turns out that if you would have been able to use customized Roles, as I initially suggested, instead of Menufiles, there's NO problem whatsoever with adding a new 'button' to the NX interface (in either a menu or a toolbar), using the Customize function, which when selected would cause your MACRO to execute. What can I say?

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
John,

Thank you a lot for your comprehensive answer. It is very helpful for me. In my case I have to change Macros to Journal files.

 
If you want to have the .macro in the menu. You have to define the action in a toolbar file

Like this...

So in the .tbr-file

BUTTON my_button
LABEL My Button
BITMAP my_button.bmp
ACTIONS ${NX_CUSTOM_DIR}\global\automation\macro\application\my_button.macro

and in the .menu file

BUTTON my_button
LABEL My Button
BITMAP my_button.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor