Hide Table of Contents
GetMassProperties Method (IBody2)

Gets the mass properties of this body.

.NET Syntax

Visual Basic (Declaration) 
Function GetMassProperties( _
   ByVal Density As System.Double _
) As System.Object
Visual Basic (Usage) 
Dim instance As IBody2
Dim Density As System.Double
Dim value As System.Object
 
value = instance.GetMassProperties(Density)
C# 
System.object GetMassProperties( 
   System.double Density
)
C++/CLI 
System.Object^ GetMassProperties( 
&   System.double Density
) 

Parameters

Density
Density to use for the mass property calculations on this body

Return Value

Array of objects (see Remarks)

Example

Remarks

This method is intended for obtaining the mass properties of temporary objects but may also be used with the SOLIDWORKS IBody2 object that is created by the user. To get the mass properties of the SOLIDWORKS IBody2 object created by the user, you can also use IModelDocExtension::GetMassProperties, which uses the density currently set for the body's material.

The return value is an array of doubles as follows:

Solid body

[ CenterOfMassX, CenterOfMassY, CenterOfMassZ, Volume, Area, Mass(Volume*density), MomXX, MomYY, MomZZ, MomXY, MomZX, MomYZ ]

Sheet body

[ CenterOfMassX, CenterOfMassY, CenterOfMassZ, Area, Circumference, Mass(Area*density), MomXX, MomYY, MomZZ, MomXY, MomZX, MomYZ ]

Wire body

[ CenterOfMassX, CenterOfMassY, CenterOfMassZ, Length, 0, Mass(Length*density), MomXX, MomYY, MomZZ, MomXY, MomZX, MomYZ ]

 

You can use ISldWorks::GetUserPreferenceDoubleValue and swMaterialPropertyDensity to get the density used by the SOLIDWORKS part. Consistent with all other SOLIDWORKS API functions, units are metric unless otherwise specified.

SOLIDWORKS returns information (such as the center of mass) in relation to where the body was created. For example, if you create a block in a part file that is centered at (0,0,0), then SOLIDWORKS returns the center of mass as (0,0,0). If you then use this part at some random location within an assembly, and the body is obtained from the assembly component object using IComponent2::GetBody, then SOLIDWORKS still returns the center of mass as (0,0,0). If you need to determine the body's center of mass in relation to the assembly coordinate system, you need to multiply the component transform and the center of mass coordinates (see IComponent2::Transform2).

 

See Also

Availability

SOLIDWORKS 2001Plus FCS Revision Number 10.0


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   GetMassProperties Method (IBody2)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:



x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2015 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.