# How to use vtkRuledSurface

**URL:** https://discourse.vtk.org/t/how-to-use-vtkruledsurface/14534
**Category:** Support
**Created:** [September 6, 2024, 8:22am UTC](https://discourse.vtk.org/t/how-to-use-vtkruledsurface/14534 "2024-09-06T08:22:59Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bassfaye](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ba9def/32.png) [@bassfaye](https://discourse.vtk.org/u/bassfaye)
#### Post date: [September 6, 2024, 8:23am UTC](https://discourse.vtk.org/t/how-to-use-vtkruledsurface/14534/1 "2024-09-06T08:23:00Z")

</div>

Hello, I want to use vtkRuledSurfaceFilter to create surface between two closed lines. These lines have the same number of points. How can I proceed to generate surface by connecting the same index point of each line? I use the method SetRuledModeToPointWalk() but it doesn’t work. Need help please?  
Thanks

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [September 6, 2024, 11:52am UTC](https://discourse.vtk.org/t/how-to-use-vtkruledsurface/14534/2 "2024-09-06T11:52:24Z")

</div>

Hello,

My two cents: the point indexes will certainly change in the output for one of the closed lines. For example, both closed lines have a point with index 0. In the result, one of the zero-index points will have another index (perhaps index n0, where n0 is the number of points of the first closed line). If you need to keep the original index information in the output, I suggest you to store the original index values as a scalar values in the input data sets.

best,

PC

---

<div class="post-metadata">

### Author: ![bassfaye](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ba9def/32.png) [@bassfaye](https://discourse.vtk.org/u/bassfaye)
#### Post date: [September 6, 2024, 1:26pm UTC](https://discourse.vtk.org/t/how-to-use-vtkruledsurface/14534/3 "2024-09-06T13:26:41Z")

</div>

Thank you for your reply.  
Perhaps my explanation is not quite clear: I don’t need to keep the original index information in the output. I need to connect each line of the first to its correspondant on the second (same index) by triangulation. Please see the uploaded picture.

 ![Sans titre](https://discourse.vtk.org/uploads/default/original/2X/2/2ac7d7a27683d0b70bb098e14d7e12fa9f2f6586.png)

Both closed lines have the same number of points.  
I used the code below but it doesn’t work.

```
vtkNew<vtkAppendPolyData> append;
append->AddInputData(closedLine1);
append->AddInputData(closedLine2);
append->Update();

vtkNew<vtkRuledSurfaceFilter> ruledSurfaceFilter;
ruledSurfaceFilter->SetInputData(append->GetOutput());
ruledSurfaceFilter->SetOrientLoops(0);
ruledSurfaceFilter->SetCloseSurface(1);
ruledSurfaceFilter->SetRuledModeToPointWalk();
ruledSurfaceFilter->Update();

```

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [September 8, 2024, 2:02pm UTC](https://discourse.vtk.org/t/how-to-use-vtkruledsurface/14534/4 "2024-09-08T14:02:19Z")

</div>

I think this is possible using vtkPolyData at a low level. E.g. Defining vtkCells yourself

---

<div class="post-metadata">

### Author: ![bassfaye](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ba9def/32.png) [@bassfaye](https://discourse.vtk.org/u/bassfaye)
#### Post date: [September 10, 2024, 2:33pm UTC](https://discourse.vtk.org/t/how-to-use-vtkruledsurface/14534/5 "2024-09-10T14:33:53Z")

</div>

Yes it works by using vtkCells. Thanks.
