Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

ProMassPropertyGet() doesn’t match Analys

williaps

New member
On each component of an assembly I am calculating mass properties referencing a csys owned by the top-level assembly. I isolate each component by creating a simplified representation that only contains the component. I am finding that when I call ProMassPropertyGet() the results are not the same as if I created a Mass Properties analysis feature within Pro/ENGINEER. For example Pro/ENGINEER always reports the mass to be 1.209 lb whereas the results from the API are 0.966. Why is Pro/ENGINEER calculating a different mass than the API?
Code:
ProError AssemblyComponent::ComputeMassProperties(ProName csysName) {


char *szFuncName = "AssemblyComponent::ComputeMassProperties()";


int i = 0,


j = 0,


nWindowId = 0;


ProError pro_error = PRO_TK_NO_ERROR;


ProMdl pro_mdl = NULL;


ProModelitem pro_modelItem;


ProSimprepdata *pro_simpRepData = NULL;


ProSimprepAction pro_simpRepAction;


ProSimprepitem pro_simpRepItem;


ProSimprep pro_simpRepTemp;


//Determine if this is the top-level


if(m_pro_asmCompPath.table_num != 0) {


//Allocate the simprep data


pro_error = ProSimprepdataAlloc(L"MPRTempRep", PRO_B_FALSE, PRO_SIMPREP_EXCLUDE, &pro_simpRepData);


PROUTIL_CALL_REPORT("ProSimprepdataAlloc()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Initialize the action


pro_error = ProSimprepActionInit(PRO_SIMPREP_INCLUDE, NULL, &pro_simpRepAction);


PROUTIL_CALL_REPORT("ProSimprepActionInit()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Get the component model


pro_error = ProAsmcomppathMdlGet(&m_pro_asmCompPath, &pro_mdl);


PROUTIL_CALL_REPORT("ProAsmcomppathMdlGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Get the model item


pro_error = ProMdlToModelitem(pro_mdl, &pro_modelItem);


PROUTIL_CALL_REPORT("ProMdlToModelitem()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Initialize the simp rep data item


pro_error = ProSimprepdataitemInit(m_pro_asmCompPath.comp_id_table, m_pro_asmCompPath.table_num, pro_modelItem.id, &pro_simpRepAction, &pro_simpRepItem);


PROUTIL_CALL_REPORT("ProSimprepdataitemInit()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Add the simp rep data item


pro_error = ProSimprepdataitemAdd(pro_simpRepData, &pro_simpRepItem);


PROUTIL_CALL_REPORT("ProSimprepdataitemAdd()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Create the simp rep


pro_error = ProSimprepCreate((ProSolid)m_pro_asmCompPath.owner, pro_simpRepData, &pro_simpRepTemp);


PROUTIL_CALL_REPORT("ProSimprepCreate()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Activate the simp rep


pro_error = ProSimprepActivate((ProSolid)m_pro_asmCompPath.owner, &pro_simpRepTemp);


PROUTIL_CALL_REPORT("ProSimprepActivate()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Display the simp rep


pro_error = ProSolidDisplay((ProSolid)m_pro_asmCompPath.owner);


PROUTIL_CALL_REPORT("ProSolidDisplay()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR && pro_error!=PRO_TK_E_FOUND);


//Get the current window id


pro_error = ProWindowCurrentGet(&nWindowId);


PROUTIL_CALL_REPORT("ProWindowCurrentGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Refit the window


pro_error = ProWindowRefit(nWindowId);


PROUTIL_CALL_REPORT("ProWindowRefit()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Free the sim rep data


pro_error = ProSimprepdataFree(&pro_simpRepData);


PROUTIL_CALL_REPORT("ProSimprepdataFree()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


pro_error = ProModelitemMdlGet(&pro_simpRepTemp, &pro_mdl);


PROUTIL_CALL_REPORT("ProModelitemMdlGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


}


else


pro_mdl = m_pro_asmCompPath.owner;


//Calculate the mass properties


pro_error = ProSolidMassPropertyGet((ProSolid)pro_mdl, csysName, &m_pro_massProperties);


PROUTIL_CALL_REPORT("ProSolidMassPropertyGet()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


//Switch the sign of the intertia tensor at COG


for(i=0;i<3;i++) {


m_pro_massProperties.cg_inertia_tensor[i][0] *= -1;


m_pro_massProperties.cg_inertia_tensor[i][1] *= -1;


m_pro_massProperties.cg_inertia_tensor[i][2] *= -1;


}


//Determine if this is the top-level


if(m_pro_asmCompPath.table_num != 0) {


//Remove the temp simp rep


pro_error = ProSimprepDelete(&pro_simpRepTemp);


ProUtilCallReport("ProSimprepDelete()", szFuncName, pro_error, pro_error!=PRO_TK_NO_ERROR);


}


return PRO_TK_NO_ERROR;


}
 
your units may not be set to proe default go to EDIT/SETUP/Units


you probably have different units set for each part in your assembly





Lou
 
That is a good guess but the mass property calculation is always being done on the assembly. Otherwise ProMassPropertyGet fails because it can't find the csys that is owned by the top-level assembly.


The real problem is that Pro/ENGINEER defaults to "Compute" and Pro/TOOLKIT defaults to "Assigned". I am unclear as to what the difference is so maybe someone could shed some light on this for me.


View attachment 4696View attachment 4697
 
Do any of the components have assigned mass? Pro/E by default calculates mass by the geometry (ignoring the assigned value) when going through the menus, but when using relations to assign the mass to a parameter it will use the assigned value, if one exists. Perhaps your problem is related to that.

I've also had a lot of erroneous information when parts have mixed units, particularly when you mix force based units with mass based units. If your assembly is pounds mass and the component is pounds force, you may get goofy results.
 
In your mass properties, you can 'assign' a mass to a part. For example, it's a vendor component and you know what it weighs, so you assign the mass rather than relying on the geometry to produce what you already know.

That pick only shows up if a component has had a mass assigned to it.

for the life of me, i don't know why Pro/E would default to 'Computed' if a mass had been assigned. If I assigned a mass, I want to use that mass!
 
Use the scroll bar in the mass properties window to see all of the densities of your parts. you will be able to see which parts are not correct. you can also print that report out for closer viewing.
 
This is interesting... The component has an assigned density of .078. It is the only component in it's parent assembly. The parent assembly has a density of .065. For some reason when I call ProSolidMassPropertyGet() on the component I am receiving results based upon the assembly. Does anyone know why the assembly value propagates down to the part???
 
Does it have an assigned mass (not density, mass)? Open the part and go to edit -> setup -> mass props. If it says 'Geometry and Parameters' someone has assigned its mass:

View attachment 4698

That will mess up your analysis when run through Analysis -> Model _> Mass Properties unless you check assigned, but when run through relations, it will be right.
 

Sponsor

Articles From 3DCAD World

Back
Top