cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to invoke an exe inside NX

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Hello

I want to invoke an external exe inside NX. I am invoking this from a custom toolbar created by me.

below is the tool bar code:


TITLE Part Costing
VERSION 170
DOCK NO

BUTTON Part _Costing

LABEL Part _Costing

ACTION PartCosting

 

under "ACTION' I am passing the "PartCasting" which is "PartCasting.exe" file and copied inside the "startup" folder. I can see my custom toolbar appearing inside NX and when I click it; it gives error:  "Could not find file PartCosting" in any of the appropriate directories.

 

Surprisingly when I copy the "PartCasting.dll" instead of "PartCasting.exe" it works perfectly.

 

8 REPLIES

Re: Unable to invoke an exe inside NX

Siemens Phenom Siemens Phenom
Siemens Phenom

Have you tried the following?:

 

ACTION PartCosting.exe

Re: Unable to invoke an exe inside NX

Siemens Phenom Siemens Phenom
Siemens Phenom

 

Here are a couple of things to consider:

 

1) Did you try putting the file in an "application" folder, rather than in "startup"?   In many cases NX will look in an "application" folder.

 

2) Was your .EXE built from .Net code (VB or C#), or was it built from C/C++?  This is important, because an executable built from .Net code will run in NX just like a .DLL - it works in the current session.  But an executable built from C/C++ will run as a separate process - it will not be aware of anything going on in your current session.

Re: Unable to invoke an exe inside NX

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Jim and Steve

Thanks for your suggestions.

Jim:

Well in ACTIOn yes I tried PartCosting.exe and it says "Unknown action type PartCosting.exe".

 

Steve:

I tried putting the .exe in application folder but same error: "Could not find file PartCosting" in any of the appropriate directories."

Yes I have build the .exe/.dll in C#.net.

Re: Unable to invoke an exe inside NX

Siemens Phenom Siemens Phenom
Siemens Phenom

 

Apparently that is not a valid action for a toolbar.  You can write a very small .DLL and use it to run your .EXE with a Shell() command...or is there any reason you could not just build your code as a class library?

Re: Unable to invoke an exe inside NX

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor
Steve
thanks. I will write a dll to run .exe. Well PartCosting.exe is created as .exe originally, I can not change that to .dll.

Re: Unable to invoke an exe inside NX

Esteemed Contributor
Esteemed Contributor

I think it is also supported to run a batch script from a menu entry.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Unable to invoke an exe inside NX

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Stefan:

I tried using .bat file to invoke the .exe but same problem.

 

Steve:

Do you have any idea whether we can use the .bat file in ACTION?

Re: Unable to invoke an exe inside NX

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Steve:

I created a dll to invoke the .exe and it worked perfectly.

Thanks

Anshu