# How to Reset VTKDistance Widget/ Distance Representation to make a new measurement in a renderer

**URL:** https://discourse.vtk.org/t/how-to-reset-vtkdistance-widget-distance-representation-to-make-a-new-measurement-in-a-renderer/11646
**Category:** Support
**Tags:** code
**Created:** [June 8, 2023, 4:51pm UTC](https://discourse.vtk.org/t/how-to-reset-vtkdistance-widget-distance-representation-to-make-a-new-measurement-in-a-renderer/11646 "2023-06-08T16:51:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pereiraplox](https://discourse.vtk.org/user_avatar/discourse.vtk.org/pereiraplox/32/7226_2.png) [@Pereiraplox](https://discourse.vtk.org/u/Pereiraplox)
#### Post date: [June 8, 2023, 4:51pm UTC](https://discourse.vtk.org/t/how-to-reset-vtkdistance-widget-distance-representation-to-make-a-new-measurement-in-a-renderer/11646/1 "2023-06-08T16:51:22Z")

</div>

Hi I have an app where after pressing a button it enables the vtk distance widget on my renderer. By pressing it again I can turn it off. However, when I press the button again my wiget reappears with the previous measurement.  
The code looks something like this (vtkdistance widget is defined in the header → ruler is my distancewidget)  
void RenderThread::ruler\_on(){

```
ruler->SetRepresentation(ruler_rep);
ruler->SetCurrentRenderer(renderer_xy());
ruler->SetInteractor(renderer_xy()->GetRenderWindow()->GetInteractor());
ruler->On();
ruler->Render();
renderer_xy->update();

```

}  
void RenderThread::ruler\_off(){

```
ruler->Off();

renderer_xy->update();

```

}

I have tried deleting the representation and other strategies but they are not working. The problem is similar to this thread [Select and delete a widget](https://discourse.vtk.org/t/select-and-delete-a-widget/2629) but the answer is not clear to me
