<?xml encoding=”UTF-8″>By Adam Nagy
As mentioned in this blog post internal units are fixed so that mass is always kg, length is always cm, etc: http://adndevblog.typepad.com/manufacturing/2012/07/unitsofmeasure-object-and-example.html
The same is true for compound units like the one for inertia, which is mass * length ^ 2, and so internally it’s kg cm^2
Based on the document settings it might be displayed as lbmass in^2. You can easily convert the internal unit to that using the above mentioned UnitsOfMeasure object:
Sub UnitTest()
Dim uom As UnitsOfMeasure
Set uom = ThisApplication.UnitsOfMeasure
Dim conversion As Double
conversion = uom.ConvertUnits(1, "kg cm^2", "lbmass in^2")
Dim doc As PartDocument
Set doc = ThisApplication.ActiveDocument
Dim mp As MassProperties
Set mp = doc.ComponentDefinition.MassProperties
Dim m As Double
m = mp.Mass
' Internal units are cm, kg
Dim Ixx As Double, Iyy As Double, Izz As Double
Dim Ixy As Double, Iyz As Double, Ixz As Double
Call mp.XYZMomentsOfInertia(Ixx, Iyy, Izz, Ixy, Iyz, Ixz)
Dim Ixx2 As Double, Iyy2 As Double, Izz2 As Double
Dim Ixy2 As Double, Iyz2 As Double, Ixz2 As Double
Ixx2 = Ixx * conversion
Iyy2 = Iyy * conversion
Izz2 = Izz * conversion
Ixy2 = Ixy * conversion
Iyz2 = Iyz * conversion
Ixz2 = Ixz * conversion
End Sub


Leave a Reply