# Center of gravity (API)

I've been looking for some API method to obtain the center of gravity for a solid, but could not find anything. In Draw, for a box, whenever I get the properties of a solid, the center of gravity is displayed:

Draw[5]> vprops b

Mass : 1

Center of gravity :
X = 0.5
Y = 0.5
Z = 0.5

Matrix of Inertia :
0.166667 -8.32667e-017 -8.32667e-017
-8.32667e-017 0.166667 -5.55112e-017
-8.32667e-017 -5.55112e-017 0.166667

Moments :
IX = 0.166667
IY = 0.166667
IZ = 0.166667

Draw[6]> box b 1 1 1
Draw[7]> vprops b

Mass : 1

Center of gravity :
X = 0.5
Y = 0.5
Z = 0.5

Matrix of Inertia :
0.166667 -8.32667e-017 -8.32667e-017
-8.32667e-017 0.166667 -5.55112e-017
-8.32667e-017 -5.55112e-017 0.166667

Moments :
IX = 0.166667
IY = 0.166667
IZ = 0.166667

Is there something similar in the API, which given a solid, can return the center of gravity?

Thanks.

the "magic" command in draw to get the code of an OCCT call is "getsourcefile"
so, in Draw, just type:
Draw[]> getsourcefile vprops
to get the filename containing the command code.

Stephane

Thanks!!! This "getsourcefile" method is a keeper.

Hello Tiberiu,

You may, actually, also visit this website: www.innoapptech.com. Try out the free sample program from the site, import a solid model (included in the package), right-click on the (solid) model and select "analyze-> geometric properties": all mass properties possible from OpenCascade will be displayed on an output window