extract_mesh_projections#

PROJECTIONS: list[tuple[str, tuple[int, int, int], int]] = [('side1', (0, 1, 0), 1), ('side2', (1, 0, 0), 0), ('top', (0, 0, 1), 2)]#

Mesh projection names, normals, and extent axes.

class ProjectionType(value)[source]#

Projection slice types.

SLICE = 1#

Slice projection type.

EXTENT = 2#

Extent projection type.

extract_mesh_projections(mesh: vtkPolyData | trimesh.Trimesh, projection_types: list[ProjectionType] | None = None, offset: tuple[float, float, float] | None = None) dict[source]#

Extract slices and/or extents from mesh.

Slice projections are taken as the cross section of the mesh with planes in the x, y, and z directions with origin at (0,0,0). Extent projections are taken as cross section of the mesh with planes in the x, y, and z directions at increments of 0.5.

Parameters:
  • mesh – Mesh object.

  • projection_types – Mesh projection types.

  • offset – Mesh translation applied before extracting slices and/or meshes.

Returns:

Map of mesh projection path points.

convert_vtk_to_trimesh(mesh: vtkPolyData) Trimesh[source]#

Convert VTK polydata to trimesh object.

Parameters:

mesh – VTK mesh object.

Returns:

Trimesh mesh object.

get_mesh_slice(mesh: Trimesh, normal: tuple[int, int, int]) list[list[list[float]]][source]#

Get slice of mesh along plane for given normal as path points.

Parameters:
  • mesh – Mesh object.

  • normal – Vector normal to slice plane.

Returns:

List of connected vertices in space specifying the slice.

get_mesh_extent(mesh: Trimesh, normal: tuple[int, int, int], index: int) dict[float, list[list[list[float]]]][source]#

Get extent of mesh along plane for given normal as path points.

Parameters:
  • mesh – Mesh object.

  • normal – Vector normal to slice plane.

  • index – Index of normal axis.

Returns:

Map to list of connected vertices in space specifying the extent.