# vtkWebViewPort: vtkOpenGLCamera has no attribute 'ResetCamera'

**URL:** https://discourse.vtk.org/t/vtkwebviewport-vtkopenglcamera-has-no-attribute-resetcamera/2654
**Category:** Web
**Created:** [February 19, 2020, 8:33am UTC](https://discourse.vtk.org/t/vtkwebviewport-vtkopenglcamera-has-no-attribute-resetcamera/2654 "2020-02-19T08:33:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![BotellaA](https://discourse.vtk.org/user_avatar/discourse.vtk.org/botellaa/32/1243_2.png) [@BotellaA](https://discourse.vtk.org/u/BotellaA)
#### Post date: [February 19, 2020, 8:33am UTC](https://discourse.vtk.org/t/vtkwebviewport-vtkopenglcamera-has-no-attribute-resetcamera/2654/1 "2020-02-19T08:33:54Z")

</div>

I am using the `vkWebViewPort` and the rpc `"viewport.camera.reset"` . Here is the error I get: `"AttributeError("'vtkmodules.vtkRenderingOpenGL2.vtkOpenGLCamera' object has no attribute 'ResetCamera'",)"`

I cannot find how the `ResetCamera` method referenced [here](https://gitlab.kitware.com/vtk/vtk/blob/master/Web/Python/vtkmodules/web/protocols.py#L147) is supposed to work. The view object is a `vtkRenderWindow` in all the examples I could find on internet.  
Thanks for your help.

---

<div class="post-metadata">

### Author: ![BotellaA](https://discourse.vtk.org/user_avatar/discourse.vtk.org/botellaa/32/1243_2.png) [@BotellaA](https://discourse.vtk.org/u/BotellaA)
#### Post date: [February 23, 2020, 8:10pm UTC](https://discourse.vtk.org/t/vtkwebviewport-vtkopenglcamera-has-no-attribute-resetcamera/2654/2 "2020-02-23T20:10:13Z")

</div>

I made it works by applying the reset on the renderer and not the camera:

```auto
    @exportRpc("viewport.camera.reset")
    def resetCamera(self, viewId):
        """
        RPC callback to reset camera.
        """
        view = self.getView(viewId)
        view.GetRenderers().GetFirstRenderer().ResetCamera()
        self.getApplication().InvalidateCache(view)
        self.getApplication().InvokeEvent('UpdateEvent')

```

Not sure how to directly use the VTK `resetCamera` without this modification.
