pysdic.Mesh.to_vtk#
- Mesh.to_vtk(filename, save_properties=True)[source]#
Write the
Meshinstance to a VTK file (Only for 3D embedding dimension meshes \(E=3\)).The mesh must not be empty.
This method uses meshio to write the Mesh instance to a VTK file.
See also
Mesh.from_vtk()for the reverse operation.Mesh.to_meshio()for more information on the conversion process.meshio documentation for more information.
- Parameters:
- Raises:
ValueError – If the file format is not supported or the mesh is empty.
- Return type:
None
Examples
Create a simple
Meshinstance.1import numpy as np 2from pysdic import Mesh, PointCloud 3 4points = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]) 5connectivity = np.array([[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]]) 6mesh3d = Mesh(PointCloud.from_array(points), connectivity)
Save the
Meshinstance to a VTK file.1mesh3d.to_vtk("simple_mesh.vtk") 2# This will create a file named 'simple_mesh.vtk' in the current directory.