pyvista_cad.CadDataSetAccessor.center_of_mass

pyvista_cad.CadDataSetAccessor.center_of_mass#

CadDataSetAccessor.center_of_mass()[source]#

Return the exact centre of mass from the cached TopoDS_Shape.

Returns:
numpy.ndarray

[x, y, z] in dataset coordinates.

Raises:
pyvista_cad.CadError

If no cached TopoDS_Shape is associated with the mesh.

Return type:

ndarray

Examples

>>> import pyvista_cad
>>> from pyvista_cad import examples
>>> cube = pyvista_cad.read_step(examples.step_cube)[0]
>>> [round(x) for x in cube.cad.center_of_mass()]
[0, 0, 0]