Code:Imports pfcls Public Class pfcSolidExamples Public Sub printMassProperties(ByRef session As IpfcBaseSession) Dim model As IpfcModel Dim solid As IpfcSolid Dim solidProperties As IpfcMassProperty Dim gravityCentre As New CpfcPoint3D Try '====================================================================== 'Get the current solid '====================================================================== model = session.CurrentModel If model Is Nothing Then Throw New Exception("Model not present") End If If (Not model.Type = EpfcModelType.EpfcMDL_PART) And _(Not model.Type = EpfcModelType.EpfcMDL_ASSEMBLY) Then Throw New Exception("Model is not a solid") End If solid = CType(model, IpfcSolid) '====================================================================== 'Get the solid properties. Optional argument in this method is the name 'of the coordinate system to use. If null, uses default '====================================================================== solidProperties = solid.GetMassProperty(Nothing) gravityCentre = solidProperties.GravityCenter MsgBox("The solid mass is: " + solidProperties.Mass.ToString + Chr(13).ToString + _"The solid volume is: " + solidProperties.Volume.ToString + Chr(13).ToString + _"The Centre of Gravity is at: " + Chr(13).ToString + _"X : " + gravityCentre.Item(0).ToString + Chr(13).ToString + _"Y : " + gravityCentre.Item(1).ToString + Chr(13).ToString + _"Z : " + gravityCentre.Item(2).ToString + Chr(13).ToString) Catch ex As Exception MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString) Exit Sub End Try End Sub End Class