pysdic.PointCloud.from_meshio#

classmethod PointCloud.from_meshio(mesh, load_properties=True)[source]#

Create a PointCloud object from a meshio.Mesh object.

The points are extracted from the mesh vertices and the properties are read from the point data.

See also

  • to_array() method for converting the point cloud back to a NumPy array.

Note

Only the vertices of the mesh are used to create the point cloud. Cells are ignored.

Parameters:
  • mesh (meshio.Mesh) – A meshio Mesh object containing the vertices.

  • load_properties (bool, optional) – If True, the point data properties from the mesh will be loaded into the point cloud. Default is True.

Returns:

A PointCloud object containing the points extracted from the mesh vertices.

Return type:

PointCloud

Raises:

ValueError – If the mesh does not contain any points.

Examples

Creating a PointCloud object from a meshio.Mesh object.

1import meshio
2from pysdic import PointCloud
3
4# Load a mesh using meshio
5mesh = meshio.read('path/to/mesh_file.vtk')
6
7# Create a point cloud from the mesh
8point_cloud = PointCloud.from_meshio(mesh)

Now, point_cloud is a PointCloud object containing the points extracted from the mesh vertices.