# How to get boundary edges from STL file?

**URL:** https://discourse.vtk.org/t/how-to-get-boundary-edges-from-stl-file/5123
**Category:** Support
**Created:** [February 2, 2021, 11:32am UTC](https://discourse.vtk.org/t/how-to-get-boundary-edges-from-stl-file/5123 "2021-02-02T11:32:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Anastasiia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/c67d28/32.png) [@Anastasiia](https://discourse.vtk.org/u/Anastasiia)
#### Post date: [February 2, 2021, 11:32am UTC](https://discourse.vtk.org/t/how-to-get-boundary-edges-from-stl-file/5123/1 "2021-02-02T11:32:03Z")

</div>

Hi everyone,

I’m trying to get boundaries from STL model.

I’ve tried the following method with converting stl to vtk, it works, but maybe there’s something more convenient?

```
mesh = meshio.Mesh.read(
"motor.stl",  
file_format="stl",)

mesh.write("motorMesh.vtk")

part = vtk.vtkUnstructuredGridReader()
part.SetFileName("motorMesh.vtk")
part.Update()

featureEdges = vtk.vtkExtractEdges()
featureEdges.SetInputConnection(part.GetOutputPort())

featureEdges.Update()

```

However, it shows all the edges, but not the boundaries.

Also, I don’t know how to use vtkExtractEdges() to get some data about the edges. Is there any option to check connected faces using vtkExtractEdges()?

---

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [February 2, 2021, 5:43pm UTC](https://discourse.vtk.org/t/how-to-get-boundary-edges-from-stl-file/5123/2 "2021-02-02T17:43:03Z")

</div>

You need to use vtkFeatureEdges filter and BoundaryEdgesOn()

Below is the C++ code to do that

> vtkSmartPointer\< vtkFeatureEdges \> featureEdges = vtkSmartPointer\< vtkFeatureEdges \>::New();  
> featureEdges-\>SetInputConnection(diskSource-\>GetOutputPort());  
> featureEdges-\>BoundaryEdgesOn();  
> featureEdges-\>FeatureEdgesOff();  
> featureEdges-\>ManifoldEdgesOff();  
> featureEdges-\>NonManifoldEdgesOff();  
> featureEdges-\>Update();

---

<div class="post-metadata">

### Author: ![fraser29](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/f/ecd19e/32.png) [@fraser29](https://discourse.vtk.org/u/fraser29)
#### Post date: [February 9, 2021, 11:39am UTC](https://discourse.vtk.org/t/how-to-get-boundary-edges-from-stl-file/5123/3 "2021-02-09T11:39:55Z")

</div>

Also, to save a step, VTK has a native STL reader:  
vtk.vtkSTLReader()

---

<div class="post-metadata">

### Author: ![Xie](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/x/ce73a5/32.png) [@Xie](https://discourse.vtk.org/u/Xie)
#### Post date: [April 9, 2026, 9:14am UTC](https://discourse.vtk.org/t/how-to-get-boundary-edges-from-stl-file/5123/4 "2026-04-09T09:14:46Z")

</div>

Hello ,Have U sloved this problem? How to show only boundaries?
