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_Shapeis associated with the mesh.
- Return type:
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]