Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 518

Inertia in custom units

$
0
0

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 complicated 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:

Units

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

Viewing all articles
Browse latest Browse all 518

Trending Articles