Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Link .dll file (journal C#) to .prt file. How to connect it?

Status
Not open for further replies.

Marsson

Mechanical
Joined
Oct 10, 2014
Messages
2
Location
FR
Dear all,

This is a tricky question but I hope some of you have so many non-standard ideas.

I have a journal in C# and I've compiled it into .dll file. This journal changing few dimensions and taking care of logic statements which determine contact surfaces.
As you probably know in Workbench is functionality to perform optimization by parameters. To achieve my goal I need to link this dll (or exe) to my NX part.
In other words:
1) I have a UG baseline model attached to Workbench.
2) I change few dimensions (parameters in Workbench).
3) Workbench open NX and send new values.
4) If change_flag=1 NX call my .dll which do few operations
5) After execution dll my model is updated.
6) Loop is closed when updated model is attached again to Workbench.

Let me summarize. Is there any way to run external dll file from expressions? Or is there any way to link external journal to Part?
Any advice can be valuable.

Thanks & Regards,

Mark
 
Sounds like you need a batch program rather than an interactive NX session. Either use \ugii\run_journal.exe or compile an .exe instead of dll file to open your model, change the values, update the model and then save the part.

From NX Open > NX Open Programmer´s Guide > Execution Methods > Executing Batch Applications

"An NX Open application .exe file can be executed directly from a command line as any other executable. Since this is a managed application, you will need to do one of the following:
Copy the NX .NET libraries to your local working directory. To do so, copy all of the libraries from the %UGII_ROOT_DIR%\managed directory to your working directory. Use standard operating system command to execute the application.
Copy your .EXE to UGII_ROOT_DIR\managed. Use standard operating system command to execute the application.
Use run_managed.exe (%UGII_ROOT_DIR%\run_managed.exe)

run_managed is a standalone executable that runs a managed NXOpen .EXE in the correct environment allowing it to pick up other DLLs from the install when they are not in the same directory as the .EXE itself.
usage:
run_managed <executable-file> <arguments>
"

Otherwise you should look into converting your program to an UDO feature.
 
Thanks for very quick reply.
I will check how run_journal.exe works but I am afraid that such solution won't work with ANSYS parametrization.

Maybe you can say something more how can I convert my program into UDO (any tutorial or similar topic)?
In NX I can only find option "Edit User Defined Object" but how to create it?

Thanks,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top