Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

UFUSR equivalent in VB.NET(How to explicitly run a NX open VB.NetProg) 1

Status
Not open for further replies.

biw01

Automotive
Dec 31, 2011
152
How to explicitly run a NX open VB.Net Prog from outside the NX Tool?

I found the following progaram in C++ for explicitly running a NX open application outside the NX, do we have a VB.NET equivalent for the same ?

*****************************************************************************/
/* Explicit Activation
** This entry point is used to activate the application explicitly, as in
** "File->Execute UG/Open->User Function..." */
extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
{
/* Initialize the API environment */
if( UF_CALL(UF_initialize()) )
{
/* Failed to initialize */
return;
}

/* TODO: Add your application code here */
try{
}//report_parents_of_drafting_curve(curve);

catch (const NXOpen::NXException& ex)
{
// ---- Enter your exception handling code here -----
// NXOpen::UI::GetUI()->NXMessageBox()->Show("UI Styler", NXOpen::NXMessageBox::DialogTypeError, ex.Message());
}


/* Terminate the API environment */
UF_CALL(UF_terminate());
}
 
Replies continue below

Recommended for you

The code you posted looks like it is written with a 'user exit' in mind. User exits are events in NX such as startup, open part, close part, create component, plot file, etc which can be used to trigger the execution of your custom function. This can also be done in VB, but you will have to compile your code to a .dll or .exe first. This will require a compiler, you can get a free version from MS, and possibly a .NET author license from Siemens. For more on user exits, see the help file Automation -> NX Open programmer's guide -> Execution methods -> User exits.

If you have journal code that is not compiled, you can run it outside of NX with the run_journal utility. More on this can be found in the help at NX Essentials -> Gateway tools -> Journals -> Running a journal from the command prompt window. NX will need to be installed on the computer that the journal is run on.

 
Thanks for the information.
The code above allows explicit activation of the application.
What i mean by explicit activation is double clicking the .exe file and running the code , rather than going through the File --> excecute-->NxOpen way and then selcting the .exe file.

This entry point is used to activate the application explicitly, as in
** "File->Execute UG/Open->User Function..." */

I am aware of user exits
And it looks something like this is VB.NET if am not wrong

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

'----Other unload options-------
'Unloads the image when the NX session terminates
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor