NX Open for C++ /* User Exit example for File-->Save.The related environment variable, * "USER_FILE" should be defined to point to the .dll built from this code */ #include #include #include #include #include #define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X))) static int report_error( char *file, int line, char *call, int irc) { if (irc) { char err[133], msg[133]; sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ", irc, line, file); UF_get_fail_message(irc, err); UF_print_syslog(msg, FALSE); UF_print_syslog(err, FALSE); UF_print_syslog("\n", FALSE); UF_print_syslog(call, FALSE); UF_print_syslog(";\n", FALSE); if (!UF_UI_open_listing_window()) { UF_UI_write_listing_window(msg); UF_UI_write_listing_window(err); UF_UI_write_listing_window("\n"); UF_UI_write_listing_window(call); UF_UI_write_listing_window(";\n"); } } return(irc); } #define WRITE(X) UF_UI_open_listing_window(); UF_UI_write_listing_window(X) static void do_it(void) { uc1601( "Running ufput user exit program.", TRUE ); } /*ARGSUSED*/ void ufput(char *param, int *retcode, int paramLen) { if (UF_CALL(UF_initialize())) return; do_it(); *retcode = 1; /* ==================== skip default behavior ============*/ UF_terminate(); } int ufusr_ask_unload(void) { return (UF_UNLOAD_IMMEDIATELY); } NX Open for .NET ' ' ' The related environment variable, "USER_FILE" ' should be defined to point to the .dll built from this code ' ' Note: This will not run as a Journal, only as a .dll ' ' Imports System Imports System.Windows.Forms Imports NXOpen Imports NXOpen.uf Imports NXOpen.utilities Module UserExit Function ufput() As Integer Dim s As Session = Session.GetSession() MessageBox.Show("Saving: " & s.Parts.Work.FullPath) ufput = 0 ' set to 1 to stop the save End Function Public Function GetUnloadOption(ByVal dummy As String) As Integer Return Session.LibraryUnloadOption.Immediately End Function End Module