马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
模板建立成功,但建立一般视图是则说是输入参数错误
ProError UserCreateSheet()
{
ProError status;
ProMdl current_mdl;
status=ProMdlCurrentGet(¤t_mdl);//
ProMdlType mdl_type;
status=ProMdlTypeGet(current_mdl,&mdl_type);
if(mdl_type!=PRO_MDL_PART&&mdl_type!=PRO_MDL_ASSEMBLY)
return PRO_TK_GENERAL_ERROR;
//模型数据
ProMdldata mdl_data;
status=ProMdlDataGet(current_mdl,&mdl_data);
ProModel model;
ProWstringCopy(mdl_data.name,model.name,PRO_VALUE_UNUSED);
ProWstringCopy(mdl_data.type,model.type,PRO_VALUE_UNUSED);
//建立工程图
ProName drawing_name=L"Drawing";
ProWstringCopy(mdl_data.name,drawing_name,PRO_VALUE_UNUSED);
ProPath tmp_name=L"_a4.drw";
UserDirectoryFullPathGet("\\template\\",tmp_name);
ProDwgcreateOptions options = PRODWGCREATE_DISPLAY_DRAWING;
ProDwgcreateErrs errors;
ProDrawing drawing;
status= ProDrawingFromTmpltCreate(drawing_name,tmp_name,&model,options, &drawing,&errors);
//获取当前图页
int sheet;
ProDrawingCurrentSheetGet(drawing,&sheet);
//设置一般视图方向
ProMatrix matrix,csysmat,inv_matrix;
ProUtilMatrixCopy(NULL,matrix);
ProUtilMatrixInvert( matrix, inv_matrix );
ProVector pos,outpos;
pos[0] = 200.0;
pos[1] = 600.0;
pos[2] = 0.0;
//建立一般视图
ProUtilPointTrans(inv_matrix,pos,outpos);
ProPntTrfEval (pos, inv_matrix, outpos);
ProView view;
status=ProDrawingGeneralviewCreate(drawing,(ProSolid)current_mdl, sheet, PRO_B_FALSE, outpos, 1, matrix, &view);
CString str;
str.Format(_T("%d"),status);
AfxMessageBox(str);//打印出status 为-2 PRO_TK_BAD_INPUTS
return status;
} |