iCAx开思网

标题: UG二次开发将part导出为iges文件 [打印本页]

作者: wwh159    时间: 2010-5-31 11:01
标题: UG二次开发将part导出为iges文件
//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;
}
作者: begtostudy    时间: 2010-6-12 15:05
学习了,这是外部模式做的吧

internal模式也可以导出
作者: yangocean    时间: 2011-2-15 03:25
internal 怎么做? 用 UF_CFI_spawn()? 3x


2# begtostudy




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3