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.

Get the Unit Metric/Imperial

stomata

New member
Hi all,
I want to get the unit of what the model is current using. I used ProMdlUnitsystemsCollect with ProUnitsystemUnitGet to get the mass unit. It returned me "kg" but when I look into the mass property from the pro/e mass properties, it shows "lbs". The value of mass I got from ProSolidMassPropertyGet were the same. That confuse my calculation.... is there any good way to get the unit system that the model is currently using??

, thanks
, Grant
 
Dear Grant,


err = ProMdlCurrentGet(&mdl);


err = ProMdlPrincipalunitsystemGet(mdl,&mdl_principal_unit_sys tem);
fprintf(ep,"ProMdlPrincipalunitsystemGet:%d\n",err);


if( err == PRO_TK_BAD_INPUTS )
return(PRO_TK_NO_ERROR);


err = ProUnitsystemIsStandard(&mdl_principal_unit_system,& unit_sys_standard);



if( unit_sys_standard == PRO_B_FALSE)
return(PRO_TK_NO_ERROR);


ProWstringToString(unit_system_name,mdl_principal_unit _system.name);


err = ProUnitsystemTypeGet(&mdl_principal_unit_system,&uni t_system_type);



if( unit_system_type == PRO_UNITSYSTEM_MLT )
{


err= ProUnitsystemUnitGet(&mdl_principal_unit_system,PRO_UNIT TYPE_MASS,&massUnit);



ProWstringToString(unit_name,massUnit.name);

}


else
{


err= ProUnitsystemUnitGet(&mdl_principal_unit_system,PRO_UNIT TYPE_FORCE,&massUnit);



ProWstringToString(unit_name,massUnit.name);




}



err= ProUnitsystemUnitGet(&mdl_principal_unit_system,PRO_UNIT TYPE_LENGTH,&lengthUnit);



ProWstringToString(unit_name,lengthUnit.name);



err= ProUnitsystemUnitGet(&mdl_principal_unit_system,PRO_UNIT TYPE_TIME,&timeUnit);



ProWstringToString(unit_name,timeUnit.name);



I think it will give solution to your problem.


With regards,


Kishore v
 
err = ProMdlPrincipalunitsystemGet(mdl,&mdl_principal_unit_sys tem);
err = ProUnitsystemTypeGet(&mdl_principal_unit_system,&uni t_system_type);

that's the combination call I am looking for...
Damn ptc documentation is very unclear in describing how these function works...
Thanks! It works!!!
 

Sponsor

Back
Top