Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Run NX command using API

Status
Not open for further replies.

rajatjain

Computer
Aug 7, 2013
11
Hi,

I am currently developing a solution where I need to run some standard NX commands using API calls. Is it possible?

Kindly advise. I am using NX 9.0

Thanks
Rajat Jain

Rajat Jain
Technical Director
JeeneDo Auto-Configure Pvt. Ltd.
 
Replies continue below

Recommended for you

Are you talking about running these "NX commands" from within the NX session itself or as part of a purely external program?

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

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

Let me describe the scenario here.

I have an addin which has an associated menu. When the user clicks on the menu command, we call a function, say f1(). This function does many processes which are internal to the addin. The function also calls native NX command (like Add Component) in its process. This call should be as good as a user clicks on the Add Component command from NX Menu.

How do we call the Native NX command using API?

I hope it explains the situation.

Kindly advise.

Thanks

Rajat Jain
Technical Director
JeeneDo Auto-Configure Pvt. Ltd.
 
I'd start by recording a journal and studying the output code.

In Preferences -> user interface -> journal, choose your language of choice. Start the journal recorder, perform a simple operation, stop the recorder, open the resulting file in a text editor. Some operations cannot be 'recorded' in this fashion, but many can.

www.nxjournaling.com
 
Hi cowski,

Thanks for your reply.

I tried this approach earlier. The Journal recorder records the functions which are used internally by the command but it does not give the command interface.

I am looking for a direct call to command through a commandManager type object.

Hope it defines the problem.

Thanks

Rajat Jain
Technical Director
JeeneDo Auto-Configure Pvt. Ltd.
 
When you say "Native NX command", do you mean using the NX API to open native NX dialogs like "Add Component" and let the user work with them (as opposed to actually adding the component with an appropriate API function)?
 
Hi,

Yes, I want to run the Native NX command (which is executed when the Menu button is pressed). The Native NX command run should automatically pop the corresponding UI.

Any help is appreciated!!!

Thanks for your help!!!

Rajat Jain
Technical Director
JeeneDo Auto-Configure Pvt. Ltd.
 
Well, there's good news and bad news. The (sort-of) good news is that there is the UF_UI C API library that allows you to call several built-in dialogs like File-New (UF_UI_create_part) or File-Open (UF_UI_open_part), as well as some feature selection and file selection dialogs (I'm sure the other APIs have similar functions, like NXOpen.FileNew etc). The bad news is that the "Add Component" dialog specifically is not among them, meaning that if you want to let users add components to their assemblies via a dialog window you have to do the following:

1) Either construct the dialog yourself with Block UI Styler (complicated, since you'll also have to implement the subsequent Constraints dialog);
2) Or call a macro file from your program that clicks the necessary button (also complicated and mostly futile, since macros are very environment-dependent, not to mention obsolete);
3) Or complain to Siemens PLM until they implement the missing function (good luck with that).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor