# vtkClipClosedSurface GenerateOutline - Width

**URL:** https://discourse.vtk.org/t/vtkclipclosedsurface-generateoutline-width/7677
**Category:** Support
**Created:** [January 19, 2022, 6:42am UTC](https://discourse.vtk.org/t/vtkclipclosedsurface-generateoutline-width/7677 "2022-01-19T06:42:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mallikarjun49](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mallikarjun49](https://discourse.vtk.org/u/mallikarjun49)
#### Post date: [January 19, 2022, 6:42am UTC](https://discourse.vtk.org/t/vtkclipclosedsurface-generateoutline-width/7677/1 "2022-01-19T06:42:47Z")

</div>

Hi All,  
I am using vtkClipClosedSurface filter to clip and close the polydata and also to generate the outline where ever the planes intersect with the polydata. I managed to give a separate color to outline by overridding **RequestData(…)** method of vtkClipClosedSurface class. The resulted outline looks very thin. Is there any way to increase the line width of the Ouline without running the vtkClipClosedSurface filter 2 times ? (one time to get only outline by generateFacesOFF and another time to get the output with faces ON).  
Any pointers would be much appreciated.  
Thank you.

```auto
vtkSmartPointer<vtkClipClosedSurface> clip1 = vtkSmartPointer<vtkClipClosedSurface>::New();
clip1->SetInputData(polydata);
clip1->SetClippingPlanes(planeCollection);
clip1->SetBaseColor(1.0,1.0,1.0);
clip1->SetClipColor(1.0,1.0,1.0);
clip1->SetScalarModeToColors();
clip1->GenerateOutlineOn();
clip1->Update();

```

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [January 19, 2022, 3:56pm UTC](https://discourse.vtk.org/t/vtkclipclosedsurface-generateoutline-width/7677/2 "2022-01-19T15:56:05Z")

</div>

You can apply vtkTubeFilter to the output of vtkClipClosedSurface. This will generate a new dataset with just the lines, where each line is thickened to form a tube.

---

<div class="post-metadata">

### Author: ![mallikarjun49](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mallikarjun49](https://discourse.vtk.org/u/mallikarjun49)
#### Post date: [January 19, 2022, 5:55pm UTC](https://discourse.vtk.org/t/vtkclipclosedsurface-generateoutline-width/7677/3 "2022-01-19T17:55:20Z")

</div>

Thank you @dgobbi for replying. I am looking for outline(different color than cut surface) along with faces as an output of vtkClipClosedSurface. Whatever the clipcolor I set, that is being taken as outline color as well. For that I had to subclass and set the different color to the outline. Is there anyway to set the outline color without subclassing?  
Tubefilter gives me thickened outline but I have to run the vtkClipClosedSurface filter 2 times(with generateFacesOn and Off).  
If the dataset is big, then running the filter 2 times adds some extra time on the performance I guess.

Thank you.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [January 19, 2022, 8:07pm UTC](https://discourse.vtk.org/t/vtkclipclosedsurface-generateoutline-width/7677/4 "2022-01-19T20:07:34Z")

</div>

No, vtkClipClosedSurface cannot set a different color for the outline. But VTK has other ways of setting colors, for example in the property of the actor:

```auto
// tell the mapper to ignore scalars on the data
mapper->ScalarVisibilityOff();
// set the actor to use a specific color
actor->GetProperty()->SetColor(1.0, 0.0, 0.0);

```

So, if you have an actor with only lines, you can control its property independent of the faces.

```auto
// create a new data set with only lines
auto lineData = vtkSmartPointer<vtkPolyData>::New();
lineData->SetPoints(clip1->GetOutput()->GetPoints());
lineData->SetLines(clip1->GetOutput()->GetLines());
lineData->BuildLinks();

```

So, you only have to execute vtkClipClosedSurface once. Note that vtkTubeFilter will also extract only the lines from the output, which is why I recommended it (also because you asked for thicker lines).

```auto
// stripper will improve the result of vtkTubeFilter
auto stripper = vtkSmartPointer<vtkStripper>::New();
stripper->SetInputData(clip1->GetOutput());
stripper->Update();

auto tube = vtkSmartPointer<vtkTubeFilter>::New();
tube->SetInputData(stripper->GetOutput());
tube->SetRadius(0.01);
tube->SetNumberOfSides(11);
tube->Update();

```

That is my recommendation. Do not use `clip1->SetScalarModeToColors()`, instead use the actors to set the color. And of course, do not execute vtkClipClosedSurface twice.

---

<div class="post-metadata">

### Author: ![mallikarjun49](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mallikarjun49](https://discourse.vtk.org/u/mallikarjun49)
#### Post date: [January 20, 2022, 5:08am UTC](https://discourse.vtk.org/t/vtkclipclosedsurface-generateoutline-width/7677/5 "2022-01-20T05:08:57Z")

</div>

> [@dgobbi](#):
>
> No, vtkClipClosedSurface cannot set a different color for the outline. But VTK has other ways of setting colors, for example in the property of the actor:

Ok.

> [@dgobbi](#):
>
> So, you only have to execute vtkClipClosedSurface once. Note that vtkTubeFilter will also extract only the lines from the output, which is why I recommended it (also because you asked for thicker lines).
> 
> ```auto
> // stripper will improve the result of vtkTubeFilter
> auto stripper = vtkSmartPointer<vtkStripper>::New();
> stripper->SetInputData(clip1->GetOutput());
> stripper->Update();
> 
> auto tube = vtkSmartPointer<vtkTubeFilter>::New();
> tube->SetInputData(stripper->GetOutput());
> tube->SetRadius(0.01);
> tube->SetNumberOfSides(11);
> tube->Update();
> 
> ```

I got it. Thank you very much @dgobbi . I appreciate your help. This works well for me.
