You could recreate the code. Here is a start but it is finished.
Dim doc As PartDocument = ThisDoc.Document
Dim uom = doc.UnitsOfMeasure
Dim nl = System.Environment.NewLine
Dim tab As Char = "\u0009"
Dim material = doc.ComponentDefinition.Material
Dim massProps = doc.ComponentDefinition.MassProperties
Dim Ixx, Iyy, Izz, Ixy, Iyz, Ixz
massProps.XYZMomentsOfInertia(Ixx, Iyy, Izz, Ixy, Iyz, Ixz)
Dim I1, I2, I3
massProps.PrincipalMomentsOfInertia(I1, I2, I3)
Dim Rx, Ry, Rz
massProps.RotationToPrincipal(Rx, Ry, Rz)
Dim txt As New StringBuilder()
txt.AppendFormat("Physical Properties for {0}{1}", doc.DisplayName, nl)
txt.AppendLine("General Properties:")
txt.AppendFormat("{1}Material:{1}{2}{0}", nl, vbTab, material.Name)
txt.AppendFormat("{1}Density:{1}{2}{0}", nl, vbTab, material.Density)
txt.AppendFormat("{1}Mass:{1}{1}{2}{0}", nl, vbTab, uom.ConvertUnits(massProps.Mass, UnitsTypeEnum.kDatabaseMassUnits, UnitsTypeEnum.kDefaultDisplayMassUnits))
txt.AppendFormat("{1}Area:{1}{1}{2}{0}", nl, vbTab, massProps.Area)
txt.AppendFormat("{1}Volume:{1}{1}{2}{0}", nl, vbTab, massProps.Volume)
txt.AppendLine("Center of Gravity:")
txt.AppendFormat("{1}X:{1}{1}{2}{0}", nl, vbTab, massProps.CenterOfMass.X)
txt.AppendFormat("{1}Y:{1}{1}{2}{0}", nl, vbTab, massProps.CenterOfMass.Y)
txt.AppendFormat("{1}Z:{1}{1}{2}{0}", nl, vbTab, massProps.CenterOfMass.Z)
txt.AppendLine("Mass Moments of Inertia with respect to ???????? (Calculated using negative integral)")
txt.AppendFormat("{1}Ixx:{1}{1}{2}{0}", nl, vbTab, Ixx)
txt.AppendFormat("{1}Ixy Iyy:{1}{2} {3}{0}", nl, vbTab, Ixy, Iyy)
txt.AppendFormat("{1}Ixz Iyz Izz:{1}{2} {3} {4}{0}", nl, vbTab, Ixz, Iyz, Izz)
txt.AppendLine("Principal Moments of Inertia with respect to Center of Gravity:")
txt.AppendFormat("{1}I1:{1}{1}{2}{0}", nl, vbTab, I1)
txt.AppendFormat("{1}I2:{1}{1}{2}{0}", nl, vbTab, I2)
txt.AppendFormat("{1}I3:{1}{1}{2}{0}", nl, vbTab, I3)
txt.AppendLine("Rotation from Global to Principal:")
txt.AppendFormat("{1}R1:{1}{1}{2}{0}", nl, vbTab, Rx)
txt.AppendFormat("{1}R2:{1}{1}{2}{0}", nl, vbTab, Ry)
txt.AppendFormat("{1}R3:{1}{1}{2}{0}", nl, vbTab, Rz)
Clipboard.SetText(txt.ToString(), TextDataFormat.Text)
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com