iCAx开思工具箱
标题:
求教proe批量转档功能
[打印本页]
作者:
hh749
时间:
2006-11-2 14:48
标题:
求教proe批量转档功能
求助怎样使用PROE二次开发实现批量转档(转IGS和CGM)
请提供VC代码
作者:
chenwenwei
时间:
2008-6-2 14:40
/*--------------------------------------------------------------------*\
定义变量
\*--------------------------------------------------------------------*/
int format_type=0;
/*
格式类型说明
PRO_IGES_3D_FILE;//设置格式为3D的IGS档
PRO_STEP_FILE;//设置格式为STP档
*/
/*============================================================================*\
Function: FileFormatToIGS
Purpose: Export current model from the igs format
\*============================================================================*/
void FileFormatToIGS()
{
ProError status,(*funp)(ProMdl *);
ProMdl out_model;
status=ProTestEnvironment();
if(status!=PRO_TK_BAD_CONTEXT)
{
format_type=(int)PRO_IGES_3D_FILE;
CreateDirectoryA("IGS",NULL);
funp=MyExportModelTo;
MyPartSelect(funp,0,&out_model);
system("del *__out.log.?");
}
else
{
MyDisplayMessageBox("错误","请先打开部件文件 !");
}
}
/*============================================================================*\
Function: FileFormatToSTP
Purpose: Export current model from the step format
\*============================================================================*/
void FileFormatToSTP()
{
ProError status,(*funp)(ProMdl *);
ProMdl out_model;
status=ProTestEnvironment();
if(status!=PRO_TK_BAD_CONTEXT)
{
format_type=(int)PRO_STEP_FILE;
CreateDirectoryA("STP",NULL);
funp=MyExportModelTo;
MyPartSelect(funp,0,&out_model);
system("del *__out.log.?");
}
else
{
MyDisplayMessageBox("错误","请先打开部件文件 !");
}
}
/*=================================================================*\
FUNCTION : MyExportModelTo()
PURPOSE : 转出部件文件为其它格式档
\*=================================================================*/
ProError MyExportModelTo(ProMdl *mdl)
{
ProError status;
ProName w_name;
ProCharLine c_name,file_name;
double quality[]={0.02,0.01};
ProImportExportFile export_type;
if(*mdl == NULL)
return(PRO_TK_BAD_INPUTS);
status = ProMdlNameGet(*mdl, w_name);
TEST_CALL_REPORT ("ProMdlNameGet()",
"ProTestExportTo()", status, status != PRO_TK_NO_ERROR);
// 设置文件名
ProWstringToString(c_name, w_name);
switch(format_type)
{
case (int)PRO_IGES_3D_FILE:
export_type=PRO_IGES_3D_FILE;
sprintf(file_name,"igs\\%s.%s",c_name,"igs");
break;
case (int)PRO_STEP_FILE:
export_type=PRO_STEP_FILE;
sprintf(file_name,"stp\\%s.%s",c_name,"stp");
break;
}
//把文件名转成宽字符串格式
ProStringToWstring(w_name,file_name);
//输出要求格式档
status = ProOutputFileWrite( *mdl, w_name, export_type, NULL,
NULL, (ProAppData)quality, NULL );
TEST_CALL_REPORT( "ProOutputFileWrite()", "ProTestExport()",
status, status != PRO_TK_NO_ERROR );
return(status);
}
作者:
!design
时间:
2008-6-8 05:29
proe安转完自带的批处理工具probatch就能够批量转图、打印的
作者:
lovey
时间:
2008-6-12 12:00
学习了,谢谢了
作者:
hh749
时间:
2008-8-20 22:22
谢谢你的代码,我早在两年前就搞定了,不过还是感谢你
欢迎光临 iCAx开思工具箱 (https://t.icax.org/)
Powered by Discuz! X3.3