parallel axis theorem

parallel axis theorem

GeorgK
Advisor Advisor
735 Views
5 Replies
Message 1 of 6

parallel axis theorem

GeorgK
Advisor
Advisor
0 Likes
Accepted solutions (1)
736 Views
5 Replies
Replies (5)
Message 2 of 6

GeorgK
Advisor
Advisor

First part:

 

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        m_invApp = GetObject(, "Inventor.Application")

        ' Set a reference to the part document.
        ' This assumes a part document is active.
        Dim oAssyDoc As AssemblyDocument
        oAssyDoc = m_invApp.ActiveDocument

        ' Set a reference to the mass properties object.
        Dim oMassProps As MassProperties
        oMassProps = oAssyDoc.ComponentDefinition.MassProperties

        'Check if mass property results are already available
        'at a high accuracy level or better. If so, simply
        'print out the results, else, set a flag to not cache
        'the results in the document.
        If oMassProps.AvailableAccuracy = MassPropertiesAccuracyEnum.k_High And
      oMassProps.AvailableAccuracy = MassPropertiesAccuracyEnum.k_VeryHigh Then
            ' Set the accuracy to high.
            oMassProps.Accuracy = MassPropertiesAccuracyEnum.k_High

            'Set CacheResultsOnCompute property to False
            'so that results are not saved with the document
            'and hence the document is not 'dirtied'.
            oMassProps.CacheResultsOnCompute = False
        End If

        ' Display the mass properties of the part.
        Debug.Print("Area: " & oMassProps.Area)
        ListBox1.Items.Add("Area: " & oMassProps.Area)


        Debug.Print("Center of Mass: " & oMassProps.CenterOfMass.X & ", " & oMassProps.CenterOfMass.Y & ", " & oMassProps.CenterOfMass.Z)
        ListBox1.Items.Add("Center of Mass: " & oMassProps.CenterOfMass.X & ", " & oMassProps.CenterOfMass.Y & ", " & oMassProps.CenterOfMass.Z)
        ListBox1.Items.Add("")

        Debug.Print("Mass: " & oMassProps.Mass)
        ListBox1.Items.Add("Mass: " & oMassProps.Mass)
        ListBox1.Items.Add("")

        Dim adPrincipalMoments(0 To 3) As Double
        Call oMassProps.PrincipalMomentsOfInertia(adPrincipalMoments(1),
        adPrincipalMoments(2),
        adPrincipalMoments(3))
        Debug.Print("Principal Moments of Inertia: " & adPrincipalMoments(1) & ", " & adPrincipalMoments(2) & ", " & adPrincipalMoments(3))
        ListBox1.Items.Add("Principal Moments of Inertia: " & adPrincipalMoments(1) & ", " & adPrincipalMoments(2) & ", " & adPrincipalMoments(3))
        ListBox1.Items.Add("")

        Dim adRadiusOfGyration(0 To 3) As Double
        Call oMassProps.RadiusOfGyration(adRadiusOfGyration(1),
        adRadiusOfGyration(2),
        adRadiusOfGyration(3))
        Debug.Print("Radius of Gyration: " & adRadiusOfGyration(1) & ", " & adRadiusOfGyration(2) & ", " & adRadiusOfGyration(3))
        ListBox1.Items.Add("Radius of Gyration: " & adRadiusOfGyration(1) & ", " & adRadiusOfGyration(2) & ", " & adRadiusOfGyration(3))
        ListBox1.Items.Add("")

        Debug.Print("Volume: " & oMassProps.Volume)
        ListBox1.Items.Add("Volume: " & oMassProps.Volume)
        ListBox1.Items.Add("")

        Dim Ixx As Double
        Dim Iyy As Double
        Dim Izz As Double
        Dim Ixy As Double
        Dim Iyz As Double
        Dim Ixz As Double
        Call oMassProps.XYZMomentsOfInertia(Ixx, Iyy, Izz, Ixy, Iyz, Ixz)
        Debug.Print("Moments: ")
        ListBox1.Items.Add("Moments: ")
        Debug.Print(" Ixx: " & Ixx)
        ListBox1.Items.Add(" Ixx: " & Ixx)
        Debug.Print(" Iyy: " & Iyy)
        ListBox1.Items.Add(" Iyy: " & Iyy)
        Debug.Print(" Izz: " & Izz)
        ListBox1.Items.Add(" Izz: " & Izz)
        Debug.Print(" Ixy: " & Ixy)
        ListBox1.Items.Add(" Ixy: " & Ixy)
        Debug.Print(" Iyz: " & Iyz)
        ListBox1.Items.Add(" Iyz: " & Iyz)
        Debug.Print(" Ixz: " & Ixz)
        ListBox1.Items.Add(" Ixz: " & Ixz)
    End Sub

How could I measure the distance between the center of gravity and a point?

Moment of inertia.png

 

 

0 Likes
Message 3 of 6

JamieVJohnson2
Collaborator
Collaborator

Use ComponentDefinition.MassProperties.CenterOfMass, if you want intellisense to work, you must use a PartComponentDefinition or an AssemblyComponentDefinition.  CenterOfMass is a point, you can then calc against any other point.  But I see that you have done that in the posted code.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 4 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

To measure distance, GetMiniumumDistance method would be useful. For more details, refer below help documentation link.

 

http://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-240D2F92-2701-4D9D-BCE7-02759538E2FC

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 6

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

how could I mesaure between the  center of mass and the point directly?

Thank you
Georg

0 Likes
Message 6 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@GeorgK,

 

Initially , create workpoint using coordinate points of center of mass and measure distance between workpoint and point.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes