JLink API to get Unit for Mass, Volumn and Density
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
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.?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Get the units from the mass properties parameter.
PRO_MP_DENSITY or something like this.
