Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Debug NX Open code through external exe application

Valued Contributor
Valued Contributor

Hi @ijb

"If you have an external application as created by the wizard you will never be able to connect to a running interactive NX session."

Correct. I have used wizard to create the app.

"To debug your external application just set breakpoints and run it from visual studio in debug mode."

Tried and code is executed without errors (see the attached video).

"If you run your exe from an interactive NX session by Execute/NX Open it is attached as a regular .net dll to your interactive session. In this case it behaves just like an internal application. Debug internal applications by starting ugraf.exe as debug task or attach the debugger to a running ugraf.exe. Then execute your application by Execute/NX Open."

Tested. Works fine. Creates a new part with a point feature.

"There is a third type of application where an external process communicates with an existing (interactive or non interactive session). Look for 'remoting' in the documentation. But I don't think that is what you want."

I think that's what I need, to run the code in the currently opened NX session by executing code directly from Visual Studio or by simple double click on exe. I will check.

 

Thank you!

(view in My Videos)

 

 

 

 

 

Re: Debug NX Open code through external exe application

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Why make things more complicated than needed?

If you need to run your own code inside of an existing NX session, the easiest is to launch a DLL and everything is OK.

You can add an icon to the NX UI and get your code executed.

I see remoting as the very last way to interact with NX.

Start simple, it is getting complex on its own.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.2, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 11.4
Development: C (ITK), .NET, Tcl/Tk Testing: NX12.0 | AWC 3.4 Preparing: NX12.0

Employees of the customers, together we are strong Smiley Wink
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide

Re: Debug NX Open code through external exe application

Valued Contributor
Valued Contributor

Hello @Stefan_Pendl,

Yes, you are right. I have many applications that developed and implemented in my NX ribbon interface.

I just wanted to find a way to manage with NX Open session through external application.

I have realized that I am not able to do that  because I am using Community edition of Visual Studio, so according to the  NX documnetation:

"The techniques used with SNAP and NX Open programs are a little unusual
because you are debugging code called by a “Main” function that you don’t have access to (because it’s inside NX).
This means that using the normal “Start Debugging” command within Visual Studio is not appropriate. There are
two alternative approaches, as outlined below, but neither of these is available in Visual Studio Express editions."

 

Please correct me if I am wrong but as far as I know Community edition of VS is replacement for Express version.

 

Thank you for the great answers!

 

Best,

Danijel

 

 

 

 

Re: Debug NX Open code through external exe application

Legend
Legend

@danijelVR  schrieb:

Hello @Stefan_Pendl,

Yes, you are right. I have many applications that developed and implemented in my NX ribbon interface.

I just wanted to find a way to manage with NX Open session through external application.

I have realized that I am not able to do that  because I am using Community edition of Visual Studio, so according to the  NX documnetation:

"The techniques used with SNAP and NX Open programs are a little unusual
because you are debugging code called by a “Main” function that you don’t have access to (because it’s inside NX).
This means that using the normal “Start Debugging” command within Visual Studio is not appropriate. There are
two alternative approaches, as outlined below, but neither of these is available in Visual Studio Express editions."

 

Please correct me if I am wrong but as far as I know Community edition of VS is replacement for Express version.

 

Thank you for the great answers!

 

Best,

Danijel

 

 

 

 


Yes and no. Community edition is the replacement for express. But there is no longer a difference to professional edition in basic functions (as eg. wizards and debugging). They changed their license model. Community edition is fully functional but commercial usage is limited.

 

So I am not aware that there is any issue with community edition that prevents you from debugging your application with it.

Yesterday you said that you sucessfully run your application in debug mode both as an external and an internal program. What does debugging means to you? Stop at exceptions, beeing able to set breakpoints and view into variables and call stack of your code? Everything should work fine. What you can't do is to debug into the NX side of code, but why would you want to do that?

 

You may have a problem with the type of application you want to develop. If it is truely necessary to have a remoting app (as it is not in most cases imho) all things will get more complex (including the debugging) but thats no debugging or visual studio problem.

 

Regards,

Jan

 

 

 

 

 

 

Jan Böttcher

Re: Debug NX Open code through external exe application

Valued Contributor
Valued Contributor
Set an environment variable
Key-PATH
Value- %UGII_ROOT_DIR%;%PATH%

Then try to run/debug

Re: Debug NX Open code through external exe application

Builder
Builder
@Legend
Hello Sir,
Where is exactly above 2 options in which setting?
I have also debugging problem for my code.

Re: Debug NX Open code through external exe application

Valued Contributor
Valued Contributor
Add this to your user environment variable. System variables.

Re: Debug NX Open code through external exe application

Builder
Builder
Hello Rahul,
What is this?
I could not understand.

Re: Debug NX Open code through external exe application

Valued Contributor
Valued Contributor

Re: Debug NX Open code through external exe application

Valued Contributor
Valued Contributor

I totally agree with @Stefan_Pendl  who said:

"If you need to run your own code inside of an existing NX session, the easiest is to launch a DLL and everything is OK."

 

I gave up from searching for the alternative solution.

 

Best,

Danijel