# vtkActor management

**URL:** <https://discourse.slicer.org/t/vtkactor-management/11839>\
**Category:** Development\
**Tags:** vtk, python\
**Created:** [June 2, 2020, 9:35pm UTC](https://discourse.slicer.org/t/vtkactor-management/11839 "2020-06-02T21:35:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eloi\_gbrt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/eloi_gbrt/32/7175_2.png) [@Eloi\_gbrt](https://discourse.slicer.org/u/Eloi_gbrt)\
**Post date:** [June 2, 2020, 9:35pm UTC](https://discourse.slicer.org/t/vtkactor-management/11839/1 "2020-06-02T21:35:37Z")

</div>

Hi everybody,  
I’m trying to create a python module which permits to display an image and different other features for a VR project purpose. To achieve this goal i decided to code functions creating the vtkActor(s) that would be added in the Slicer Renderer. I reached the renderer using those lines :

lm = slicer.app.layoutManager()  
renderer = lm.threeDWidget(0).threeDView().renderWindow().GetRenderers().GetFirstRenderer()

My issue is that i would want the user to be able to add or remove the different volume rendered that match with the vtkActors(s) i mentionned. So i used checkboxes and adding the actors works fine and render what i wanted but i cannot update any of them or remove them. I would like to know if it is possible to get the different actors from the renderer precisely or if there is another method to track what i add in order to be able to manage it at will.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 2, 2020, 9:54pm UTC](https://discourse.slicer.org/t/vtkactor-management/11839/2 "2020-06-02T21:54:25Z")

</div>

If you insert objects into the scene as model nodes (`slicer.modules.models.logic().AddModel(somVtkPolyDataObject)`) then you can [grab and move them using VR controllers](https://github.com/KitwareMedical/SlicerVirtualReality#transform-objects).

---

<div class="post-metadata">

**Author:** ![Eloi\_gbrt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/eloi_gbrt/32/7175_2.png) [@Eloi\_gbrt](https://discourse.slicer.org/u/Eloi_gbrt)\
**Post date:** [June 2, 2020, 10:10pm UTC](https://discourse.slicer.org/t/vtkactor-management/11839/3 "2020-06-02T22:10:39Z")

</div>

To be honest i don’t really have to use VR for now. I just want to display everything correctly and to be able to have control over it with the UI. Can I remove or update this model with a simple function too ?  
I didn’t find a RemoveModel() function.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 2, 2020, 10:27pm UTC](https://discourse.slicer.org/t/vtkactor-management/11839/4 "2020-06-02T22:27:36Z")

</div>

You can remove the node by using `slicer.mrmlScene.RemoveNode` method. You can move around a model if you apply a transform to it and show the transform interactor in Transforms module / Display / Interaction.

---

<div class="post-metadata">

**Author:** ![Eloi\_gbrt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/eloi_gbrt/32/7175_2.png) [@Eloi\_gbrt](https://discourse.slicer.org/u/Eloi_gbrt)\
**Post date:** [June 2, 2020, 10:36pm UTC](https://discourse.slicer.org/t/vtkactor-management/11839/5 "2020-06-02T22:36:29Z")

</div>

Ok, thank you, i’ll try it.
