#include #include #include #include extern "C" DllExport void ufusr(char *p, int * ret, int pp) { UF_initialize(); const std::string inputFilePath="C:\\Documents\\model3.prt"; const std::string outputFilePath="C:\\Documents\\model3333334.prt"; const std::string runMacroFunctionName="MACRO_playback_from_usertool"; UF_load_f_p_t runMacroFunctionPtrT=NULL; int r = UF_load_library("C:\\Program Files\\UGS\\NX 6.0\\UGII\\libugui.dll","?MACRO_playback_from_usertool@@YAXPBD@Z", &runMacroFunctionPtrT); void (*runMacroFunctionPtr)(char *) = (void (*)(char*))runMacroFunctionPtrT; tag_t prtFile=NULL_TAG; UF_PART_load_status_t openErr; UF_PART_open(inputFilePath.c_str(), &prtFile, &openErr); Sleep(3000); //runMacroFunctionPtr("C:\\Documents\\wrl.macro"); if(prtFile != NULL_TAG) { UF_PART_save_as(outputFilePath.c_str()); runMacroFunctionPtr("C:\\Documents\\wrl.macro"); Sleep(3000); //UF_PART_close(prtFile, 1, 1); } UF_terminate(); }