×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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());
}

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

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.

www.nxjournaling.com

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

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources