mesh_slice_plane
- compas.datastructures.mesh_slice_plane(mesh, plane)[source]
Slice a mesh with a plane and construct the resulting submeshes.
- Parameters
mesh (compas.datastructures.Mesh) – The original mesh.
plane (compas.geometry.Plane) – The cutting plane.
- Returns
None or tuple of
compas.datastructures.Mesh
– If the mesh and plane do not intersect, or if the intersection is degenerate (point or line), the function returnsNone
. Otherwise, the “positive” and “negative” submeshes are returned.
Examples
>>> from compas.geometry import Plane >>> from compas.geometry import Box >>> from compas.datastructures import Mesh >>> plane = Plane((0, 0, 0), (1, 0, 0)) >>> box = Box.from_width_height_depth(1, 1, 1) >>> mesh = Mesh.from_shape(box) >>> result = mesh_slice_plane(mesh, plane) >>> len(result) == 2 True