马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
//full_path: path to save igs file
//part_name:current displayed part name
int Export_Part_to_IGES(CString full_path, CString part_name)
{
char cmdfilename[MAX_FSPEC_SIZE+1];
char cmdtext[256],trtool[256],trsour[256],trdes[256],trdef[256];
FILE * filestream;
char *UG_dir;
UF_translate_variable("UGII_BASE_DIR", &UG_dir);
strcpy(cmdfilename,full_path);
strcat(cmdfilename,"temp.bat");
filestream = fopen(cmdfilename,"w");
strcpy(cmdtext,"@echo off\n");
fprintf(filestream,"%s",cmdtext);
strcpy(trtool,"\"");
strcat(trtool,UG_dir);
strcat(trtool,"\\iges\\iges.cmd\" ");
strcpy(trsour,"\"");
strcat(trsour,full_path);
strcat(trsour,part_name);
strcat(trsour,".prt\" ");
strcpy(trdes,"o=\"");
strcat(trdes,full_path);
strcat(trdes,part_name);
strcat(trdes,".igs\" ");
strcpy(trdef,"d=\"");
strcat(trdef,UG_dir);
strcat(trdef,"\\iges\\igesexport.def\"");
fprintf(filestream,"%s%s%s%s\n",trtool,trsour,trdes,trdef); G
fclose(filestream);
SHELLEXECUTEINFO ShExecInfo;
ShExecInfo.cbSize = sizeof( SHELLEXECUTEINFO );
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = cmdfilename;
ShExecInfo.lpParameters = NULL;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_HIDE;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx( &ShExecInfo );
WaitForSingleObject( ShExecInfo.hProcess,INFINITE );
return 0;
} |