# How to get boundary surface mesh from tetrahedral volume?

**URL:** https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109
**Category:** Support
**Created:** [August 8, 2022, 9:50pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109 "2022-08-08T21:50:15Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![JayEspi](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@JayEspi](https://discourse.vtk.org/u/JayEspi)
#### Post date: [August 8, 2022, 9:50pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109/1 "2022-08-08T21:50:15Z")

</div>

Setup: VTK v9.2, Linux, Python v3.9

I have an object defined by a tetrahedral mesh.

I would like to extract the surface mesh (triangles) of this volume. When I use vtkGeometryFilter, I get polydata where the 4 faces of every tetrahedron have been converted to triangles. This is contrary to the documentation that states: “All 2D faces that are used by only one 3D cell (i.e., boundary faces) are extracted”.

How do I get just the outer triangular faces?

---

<div class="post-metadata">

### Author: ![Christos\_Tsolakis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/christos_tsolakis/32/2076_2.png) [@Christos\_Tsolakis](https://discourse.vtk.org/u/Christos_Tsolakis)
#### Post date: [August 8, 2022, 10:13pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109/2 "2022-08-08T22:13:17Z")

</div>

> I get polydata where the 4 faces of every tetrahedron have been converted to triangles.

Do you reuse point ids? It sounds like you define every tetrahedron using new point ids each time. This causes the geometry filter to think that all points are distinct, so all 2D faces are distinct and thus they are used by one tetrahedron.

Try to define each point only once and re-use point ids. Alternatively, you can merge the coincident points. ParaView has this functionality as `Clean To Grid` filter but unfortunately it does not exists in VTK. Still, you can use it to verify that this is indeed the issue with your dataset.

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [August 8, 2022, 10:27pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109/3 "2022-08-08T22:27:09Z")

</div>

In VTK the cleaning filters are vtkStaticCleanPolyData and vtkCleanPolyData

---

<div class="post-metadata">

### Author: ![JayEspi](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@JayEspi](https://discourse.vtk.org/u/JayEspi)
#### Post date: [August 8, 2022, 10:42pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109/4 "2022-08-08T22:42:09Z")

</div>

That’s the likely cause. Thank you for pointing that out.

I need a VTK-only method to consolidate redundant points now.

---

<div class="post-metadata">

### Author: ![Christos\_Tsolakis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/christos_tsolakis/32/2076_2.png) [@Christos\_Tsolakis](https://discourse.vtk.org/u/Christos_Tsolakis)
#### Post date: [August 8, 2022, 10:57pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109/5 "2022-08-08T22:57:49Z")

</div>

Based on Will’s suggestion you can try [vtkStaticCleanUnstructuredGrid](https://vtk.org/doc/nightly/html/classvtkStaticCleanUnstructuredGrid.html) .

---

<div class="post-metadata">

### Author: ![JayEspi](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@JayEspi](https://discourse.vtk.org/u/JayEspi)
#### Post date: [August 9, 2022, 3:09pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109/6 "2022-08-09T15:09:08Z")

</div>

The method vtkStaticCleanUnstructuredGrid worked. Thanks again for the assistance.

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [August 9, 2022, 3:14pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-surface-mesh-from-tetrahedral-volume/9109/7 "2022-08-09T15:14:57Z")

</div>

Excellent, and thanks to Christos for actually supplying the answer you needed 🙂
