Solid Edge Part Type Library
ComputePhysicalProperties Method
Specifies the density to use in the physical property calculations.
Specifies the accuracy used when computing the physical properties.
Returns the volume of the model.
Returns the surface area of the model.
Returns the mass of the model.
Returns three double values to indicate the x-, y-, and z-coordinates of the center of gravity of the model.
Returns three double values to indicate the x-, y-, and z-coordinates of the center of volume of the model.
Returns six double values to indicate the Ixx, Iyy, Izz, Ixy, Ixz, and Iyz components of the global moments of inertia of the model.
Returns three double values to indicate the lxx, lyy, and lzz components of the principal moments of inertia of the model.
Returns nine double values to indicate the orientation of the principal axes of the model.
Returns three double values to indicate the radii of gyration of the model.
Returns a double value to indicate the actual accuracy achieved when calculating the physical properties. The accuracy parameter specifies the maximum accuracy, but, depending on the geometry of the model, the physical properties can be calculated more accurately.
Returns an integer value that indicates the status of the physical properties of the model.
Description
Calculates the physical properties of the referenced object.
Syntax
Visual Basic
Public Sub ComputePhysicalProperties( _
   ByVal Density As Double, _
   ByVal Accuracy As Double, _
   ByRef Volume As Double, _
   ByRef Area As Double, _
   ByRef Mass As Double, _
   ByRef CenterOfGravity() As Double, _
   ByRef CenterOfVolume() As Double, _
   ByRef GlobalMomentsOfInteria() As Double, _
   ByRef PrincipalMomentsOfInteria() As Double, _
   ByRef PrincipalAxes() As Double, _
   ByRef RadiiOfGyration() As Double, _
   ByRef RelativeAccuracyAchieved As Double, _
   ByRef Status As Integer _
) 
Parameters
Density
Specifies the density to use in the physical property calculations.
Accuracy
Specifies the accuracy used when computing the physical properties.
Volume
Returns the volume of the model.
Area
Returns the surface area of the model.
Mass
Returns the mass of the model.
CenterOfGravity
Returns three double values to indicate the x-, y-, and z-coordinates of the center of gravity of the model.
CenterOfVolume
Returns three double values to indicate the x-, y-, and z-coordinates of the center of volume of the model.
GlobalMomentsOfInteria
Returns six double values to indicate the Ixx, Iyy, Izz, Ixy, Ixz, and Iyz components of the global moments of inertia of the model.
PrincipalMomentsOfInteria
Returns three double values to indicate the lxx, lyy, and lzz components of the principal moments of inertia of the model.
PrincipalAxes
Returns nine double values to indicate the orientation of the principal axes of the model.
RadiiOfGyration
Returns three double values to indicate the radii of gyration of the model.
RelativeAccuracyAchieved
Returns a double value to indicate the actual accuracy achieved when calculating the physical properties. The accuracy parameter specifies the maximum accuracy, but, depending on the geometry of the model, the physical properties can be calculated more accurately.
Status
Returns an integer value that indicates the status of the physical properties of the model.
Remarks
Working from two inputs, density and accuracy, ComputePhysicalProperties calculates the physical properties of the referenced model. (It is assumed that there is one part per file.) This method acts on all solid geometry in the file and includes disjoint features. When no properties have previously been computed, ComputePhysicalProperties computes and returns the physical properties of the model. When properties have previously been computed but are out of date, ComputePhysicalProperties recomputes and then returns the physical properties of the model. When properties have previously been computed but are up to date, ComputePhysicalProperties returns the physical properties of the model without recalculating.
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeFrameWork.Application
    Dim objDoc As SolidEdgePart.PartDocument
    Dim objModel As SolidEdgePart.Model
    Dim objProfile As SolidEdgePart.Profile
    Const TESTFILE = "T:\vbtests\testcases\cube.par"
    Const TOLERANCE = 0.0001
    Dim dblDensity As Double
    Dim dblAccuracyIn As Double
    Dim dblAccuracyOut As Double
    Dim dblVolume As Double
    Dim dblArea As Double
    Dim dblMass As Double
    Dim dblCofGravity() As Double
    Dim dblCofVolume() As Double
    Dim dblGlobalMoments() As Double
    Dim dblPrincipalMoments() As Double
    Dim dblPrincipalAxes() As Double
    Dim dblRadiiOfGyration() As Double
    Dim lngStatus As Long
    ' Report errors
    Const PI = 3.14159265358979
    ' Create/get the application with specific settings
    On Error Resume Next
    Set objApp = GetObject(, "SolidEdge.Application")
    If Err Then
        Err.Clear
        Set objApp = CreateObject("SolidEdge.Application")
        Set objDoc = objApp.Documents.Add("SolidEdge.PartDocument")
        objApp.Visible = True
    Else
        Set objDoc = objApp.ActiveDocument
    End If
    ' Close the part document
    Call objDoc.Close
    ' Open a Testcase
    Set objDoc = objApp.Documents.Open(Filename:=TESTFILE)
    ' Get the model object in the test case
    Set objModel = objDoc.Models(1)
    '************************
    ' CASE 1 : Compute the Physical Properties on base model
    '************************
    ' Compute the physical properties on the model.
    dblDensity = 1
    dblAccuracyIn = 0.0001
    Call objModel.ComputePhysicalProperties( _
         Density:=dblDensity, Accuracy:=dblAccuracyIn, Volume:=dblVolume, _
         Area:=dblArea, Mass:=dblMass, CenterOfGravity:=dblCofGravity, _
         CenterOfVolume:=dblCofVolume, _
         GlobalMomentsOfInteria:=dblGlobalMoments, _
         PrincipalMomentsOfInteria:=dblPrincipalMoments, _
         PrincipalAxes:=dblPrincipalAxes, _
         RadiiOfGyration:=dblRadiiOfGyration, _
         RelativeAccuracyAchieved:=dblAccuracyOut, Status:=lngStatus)
    ' Checking the physical properties of model
    If Abs(dblVolume - 0.001) > TOLERANCE Or Abs(dblArea - 0.06) > TOLERANCE Or _
       Abs(dblMass - 0.001) > TOLERANCE Or Abs(dblAccuracyOut - 0.0001) > TOLERANCE Then
        MsgBox ("ComputePhysicalProperties method of Model object fails")
    End If


    '***********************************
    ' CASE 2 : Compute the Physical Properties on updated model
    '***********************************
    'Compute the the physical properties on the updated model. _
     Since the updated model has been not computed so _
     ComputePhysicalProperties should recompute and then return the _
     physical properties of the updated model.
    objModel.ExtrudedProtrusions(1).Depth = 0.125
    ' Compute the physical properties on the updated model.
    dblDensity = 1
    dblAccuracyIn = 0.0001
    Call objModel.ComputePhysicalProperties( _
         Density:=dblDensity, Accuracy:=dblAccuracyIn, Volume:=dblVolume, _
         Area:=dblArea, Mass:=dblMass, CenterOfGravity:=dblCofGravity, _
         CenterOfVolume:=dblCofVolume, _
         GlobalMomentsOfInteria:=dblGlobalMoments, _
         PrincipalMomentsOfInteria:=dblPrincipalMoments, _
         PrincipalAxes:=dblPrincipalAxes, _
         RadiiOfGyration:=dblRadiiOfGyration, _
         RelativeAccuracyAchieved:=dblAccuracyOut, Status:=lngStatus)
    ' Checking the physical properties of updated model
    If Abs(dblVolume - 0.00125) > TOLERANCE Or Abs(dblArea - 0.07) > TOLERANCE Or _
       Abs(dblMass - 0.00125) > TOLERANCE Or Abs(dblAccuracyOut - 0.0001) > TOLERANCE Then
        MsgBox ("ComputePhysicalProperties method of Model object fails")
    End If

    '***********************************
    ' CASE 3 : Compute the Physical Properties on Failed model
    '***********************************
    ' Create a failed feature and Compute physical properties on Failed model
    Set objProfile = objDoc.ProfileSets.Add.Profiles.Add(objDoc.RefPlanes(1))
    Call objProfile.Circles2d.AddByCenterRadius(0.015, 0.015, 0.005)
    Call objProfile.End(igProfileClosed)
    Call objModel.ExtrudedProtrusions.AddFinite(objProfile, igLeft, igLeft, 0.015)
    If objModel.ExtrudedProtrusions(2).Status <> igFeatureFailed Then
        MsgBox "Failed to create a sick feature"
    End If
    objProfile.Visible = False
    ' Compute the physical properties on the failed model.
    dblDensity = 1
    dblAccuracyIn = 0.0001
    Call objModel.ComputePhysicalProperties( _
         Density:=dblDensity, Accuracy:=dblAccuracyIn, Volume:=dblVolume, _
         Area:=dblArea, Mass:=dblMass, CenterOfGravity:=dblCofGravity, _
         CenterOfVolume:=dblCofVolume, _
         GlobalMomentsOfInteria:=dblGlobalMoments, _
         PrincipalMomentsOfInteria:=dblPrincipalMoments, _
         PrincipalAxes:=dblPrincipalAxes, _
         RadiiOfGyration:=dblRadiiOfGyration, _
         RelativeAccuracyAchieved:=dblAccuracyOut, Status:=lngStatus)

    ' USER DISPLAY
    ' Release objects
    Dim i As Integer
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objModel = Nothing
    Set objProfile = Nothing
End Sub
See Also

Model Object  | Model Members