mesh.Mesh.slice#

Mesh.slice(dir=0, n_planes=10)#

Intersect a triangular surface mesh with a series of parallel planes.

Parameters#

dir: int or array_like (3,)

The direction of the normal on the planes. A single int (0..2) may be used to specify one of the global axes (0 = x-axis, 1 = y-axis, 2 = z-axis).

n_planesint

Number of slicing planes. The planes are positioned evenly between the minimum and maximum coordinates of the surface along the slicing direction, excluding the boundary values. Thus, n_planes planes partition the surface into n_planes + 1 sections of equal length. Must be >= 1.

Returns#

list of Mesh

A list of n_planes meshes of type ‘line2’, representing the intersection of the triangular surface mesh with each plane.

Notes#

  • Only available for meshes with eltype='tri3'.

Examples#

>>> M = Mesh(eltype='hex8').border_mesh().convert('tri3')
>>> slices = M.slice(dir=1, n_planes=10)
>>> print(len(slices))
10