User Exit (User Exit) is an important concept in the NX Open. NX provisions exist during operation export certain position, when the process of implementation of these exports, NX automatically checks whether the user has defined the point where the position of the internal procedures of the environment variable: if not defined, places NX the default way to continue running forever; if defined, from where the auto-run customized applications. Using different User Exit, can be performed automatically when the application is running customized to a specific point in NX. Each has a unique User Exit outlet name, so that the user calls the subroutine, different use of User Exit export function, most commonly User Exit is ufsta () and ufusr (), ufsta () is the NX start menu User Exit when, ufusr () is the direct activation of User Exit. Typically, the parameters and return value of the function User Exit are the same. User Exit function is defined as follows: void entry function name (char * param, int * retcode , int rlen); and wherein param retcode output parameter, is the length parameter param RLEN automatically handled by the NX system.
According to the first column of the table at the end, you can accomplish many method calls the dll. Following to run the open dll Example member .
The first step in setting environment variables:
Method 1 (not recommended): Right Computer -> Properties -> Advanced System Settings -> Environment Variables
Method 2: Open "..... \ Siemens \ NX 12.0 \ UGII \ ugii_env_ug.dat", the search operation to find the open member dll, corresponding environment variable USER_RETRIEVE, found some in ugii_env_ug.dat file (see below), then the "# USER_RETRIEVE =" changed to "USER_RETRIEVE = D: \ WangPaiFeiXingYuan.dll".
The second step export functions:
Dll need to run an inlet ufget, an example where the opening member:
. 1 #include <uf.h> 2 #include <uf_ui.h> . 3 #include <uf_exit.h> . 4 extern dllexport void ufget ( char * param, int * the returnCode, int RLEN) // note inlet not ufusr . 5 { . 6 UF_initialize (); . 7 uc1601 ( " the Hello ace! " , . 1 ); . 8 UF_terminate (); . 9 } 10 . 11 extern int ufusr_ask_unload ( void ) 12 is { 13 return (UF_UNLOAD_IMMEDIATELY); 14 }
Generated dll step onto the path specified in the environment variable.
The third step is to open the NX, click to open the parts, the test is successful!
Annex: environmental variables, the user exit correspondence table.
description | Environment Variables | Entry function |
Open Part | USER_RETRIEVE | ufget |
New Part | USER_CREATE | UFCR |
Save Part | USER_FILE | ufput |
Save Part As | USER_SAVEAS | ufsvas |
Import Part | USER_MERGE | ufmrg |
Execute GRIP Program | USER_GRIP | ufgrp |
Add Existing Part | USER_RCOMP | ufrcp |
Export Part | USER_FCOMP | uffcp |
Component Where-used | USER_WHERE_USED | ufusd |
Plot File | USER_PLOT | ufplt |
2D Analysis Using Curves | USER_AREAPROPCRV | uf2da |
User Defined Symbols | USER_UDSYMBOL | ufuds |
Open CLSF | USER_CLS_OPEN | ufclso |
Save CLSF | USER_CLS_SAVE | ufclss |
Rename CLSF | USER_CLS_RENAME | ufclsr |
Generate CLF | USER_CL_GEN | ufclg |
Postprocess CLSF | USER_POST | ufpost |
Create Component | USER_CCOMP | ufccp |
Change Displayed Part | USER_CDISP | ufcdp |
Change Work Part | USER_CWORK | ufcwp |
Remove Component | USER_DCOMP | ufdcp |
Reposition Component | USER_MCOMP | ufmcp |
Substitute Component Out | USER_SCOMP1 | ufscpo |
Substitute Component In | USER_SCOMP2 | ufscpi |
Open Spreadsheet | USER_SPRD_OPN | ufspop |
Close Spreadsheet | USER_SPRD_CLO | ufspcl |
Update Spreadsheet | USER_SPRD_UPD | ufspup |
Finish Updating Spreadsheet | USER_SPRD_UPF | ufspuf |
Replace Reference Set | USER_RRSET | ufrrs |
Rename Component | USER_NCOMP | ufncp |
NX Startup | USER_STARTUP | ufsta |
Access Genius Library Management System | USER_GENIUS | ufgen |
Execute DebUG GRIP | USER_GRIPDEBUG | ufgrpd |
Execute User Function | USER_UFUNC | ufufun |
Initialize new operation | USER_CREATE_OPER | ufnopr |
CAM Startup | USER_CAM_STARTUP | ufcams |