Center of Gravity for Autodesk Inventor

Let’s say you want to have the center of gravity to be plotted onto your drawing file (idw file) so that you could keep a documentation of it. What you can do is to create a macro where the program automates the generation of workpoint based on the properties of the mass of the assembly document and or the part document. After running the macro, create a new drawing (idw file) and get the base view of that document. Make sure that in the display options that the User Work Features are checked. Now, the question that you probably have in mind is what if I have other work features that I do not want to be shown? What you just do is to hide the other work features manually by expanding a certain view in the browser tree. It’s just like hiding parts within an assembly environment.

Here’s the macro that I’ve created using the Visual Basic Editor within Autodesk Inventor 11.


Public Sub Cog( )

Dim oAssemblyDoc As AssemblyDocument
Set oAssemblyDoc = ThisApplication.ActiveDocument

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

'x y and z coordinates of the COG
Dim X
Dim Y
Dim Z

'Setting the values for x, y and z coordinates of COG
X = oMassProps.CenterOfMass.X
Y = oMassProps.CenterOfMass.Y
Z = oMassProps.CenterOfMass.Z

Dim oTrans As TransientGeometry
Set oTrans = ThisApplication.TransientGeometry

Dim oPnt As Point
Set oPnt = oTrans.CreatePoint(X, Y, Z)

Dim oWorkPoint1 As WorkPoint
Set oWorkPoint1 =
oAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(oPnt, False)

End Sub

3 responses to “Center of Gravity for Autodesk Inventor”

Leave a Reply

Your email address will not be published. Required fields are marked *