cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

JLink API to get Unit for Mass, Volumn and Density

nikhil1mahajan
8-Gravel

JLink API to get Unit for Mass, Volumn and Density

Hello,

 

I am writing Jlink code to get the Mass, Density and Volume on a CAD part. I am able to fetch these values but I am not able to get the unit for Density and Volume. I am using following API;s

 

properties = solid.GetMassProperty(null);
System.out.println("Session model "+em.GetFileName());
System.out.println("The solid mass is: " + properties.GetMass()+" "+unitsys.GetUnit(UnitType.UNIT_MASS).GetName());
System.out.println("The solid volume is: " + properties.GetVolume()+" "+unitsys.GetUnit(UnitType.UNIT_MASS).GetName());
System.out.println("The solid density is: " + properties.GetDensity()+" "+unitsys.GetUnit(UnitType.UNIT_MASS).GetName());

 

OutPUT:

nikhil1mahajan_0-1684392644412.png

 

As you can see the unit for Volume and Density is lbm, which is wrong. And there is no UnitType.UNIT_VOLUME or UnitType.UNIT_DENSITY that I can pass as a parameter.

I tried to find the JLink API that I can use to get the unit of measure for Volume and Density but I couldn't.

 

I know Density = Mass/Volume, so does that mean that I need to get the metric system and calculate the UOM for Volume and Density at run time in code.?

 

 

 

 

 

 

 

 

1 REPLY 1

Get the units from the mass properties parameter.

 

PRO_MP_DENSITY or something like this.

Announcements


Top Tags