美文网首页
Example 2: Retrieve, Calculate,

Example 2: Retrieve, Calculate,

作者: 锦囊喵 | 来源:发表于2020-07-02 21:29 被阅读0次
#include "ProToolkit.h"
 #include "ProCore.h"
 #include "ProMdl.h"
 #include "ProSolid.h"
 #include "ProUtil.h"
/*====================================================================*\
 FUNCTION : UsrMassGet()
 PURPOSE : Output the mass of a specified Pro/ENGINEER solid
 \*====================================================================*/
 int UsrMassGet(
 ProCharName name,
 ProMdlType type,
 double *mass)
 {
 ProName wname;
 ProError status;
 ProMdl mdl;
 ProMassProperty massprops;
/*--------------------------------------------------------------------*\
 Check that the model is a part or assembly
 \*--------------------------------------------------------------------*/
 if(type != PRO_MDL_PART &&
 type != PRO_MDL_ASSEMBLY)
 return(0);
/*--------------------------------------------------------------------*\
 Retrieve it
 \*--------------------------------------------------------------------*/
 ProStringToWstring(wname, name);
 if(ProMdlRetrieve(wname, type, &mdl) != PRO_TK_NO_ERROR)
 return(0);
/*--------------------------------------------------------------------*\
 Get the mass properties
 \*--------------------------------------------------------------------*/
 if(ProSolidMassPropertyGet((ProSolid)mdl, NULL, &massprops) !=
PRO_TK_NO_ERROR)
 return(0);
 *mass = massprops.mass;
/*--------------------------------------------------------------------*\
 Erase it from memory
 \*--------------------------------------------------------------------*/
 ProMdlErase(mdl);
 return(1);
 }

相关文章

网友评论

      本文标题:Example 2: Retrieve, Calculate,

      本文链接:https://www.haomeiwen.com/subject/xcedqktx.html