# Mesh/Plane intersection

**URL:** <https://forum.compas-framework.org/t/mesh-plane-intersection/360>\
**Category:** compas\
**Created:** [July 23, 2020, 6:36am UTC](https://forum.compas-framework.org/t/mesh-plane-intersection/360 "2020-07-23T06:36:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cesare.caoduro](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@cesare.caoduro](https://forum.compas-framework.org/u/cesare.caoduro)\
**Post date:** [July 23, 2020, 6:36am UTC](https://forum.compas-framework.org/t/mesh-plane-intersection/360/1 "2020-07-23T06:36:21Z")

</div>

Is there any plan to include a Mesh/Plane intersection, similar to what is possible in GH with an output of a polycurve?

---

<div class="post-metadata">

**Author:** ![tomvanmele](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/tomvanmele/32/13_2.png) [@tomvanmele](https://forum.compas-framework.org/u/tomvanmele)\
**Post date:** [August 3, 2020, 6:04pm UTC](https://forum.compas-framework.org/t/mesh-plane-intersection/360/2 "2020-08-03T18:04:33Z")

</div>

there is `mesh_cut_by_plane` in the core library (however, this function doesn’t return an intersection polygon), but a more robust and much faster version is available in `compas_cgal`. ([https://blockresearchgroup.github.io/compas\_cgal/](https://blockresearchgroup.github.io/compas_cgal/))

the new plugin system will soon allow the CGAL based version to be plugged into core COMPAS and use it from there…

---

<div class="post-metadata">

**Author:** ![mononym](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/mononym/32/211_2.png) [@mononym](https://forum.compas-framework.org/u/mononym)\
**Post date:** [September 3, 2020, 9:37am UTC](https://forum.compas-framework.org/t/mesh-plane-intersection/360/3 "2020-09-03T09:37:08Z")

</div>

```
from compas.datastructures import Mesh
from compas.geometry import Line, Plane, Vector
from compas.geometry import is_point_on_plane

mesh = Mesh.from_polyhedron(8)
normal = Vector(0, 1, 0)
plane = Plane([0,0,0], normal)
# cut mesh by plane
section1, _ = mesh.cut(plane)

# get intersection line
cut = []
for vert1, vert2 in section1.edges():
    p1, p2 = section1.vertex_coordinates(vert1), section1.vertex_coordinates(vert2)
    if is_point_on_plane(p1, plane) and is_point_on_plane(p2, plane):
        cut.append(Line(p1, p2))

section = Mesh.from_lines(cut)
```
