# Change the radius of picked actor (vtkSphereSource)

**URL:** https://discourse.vtk.org/t/change-the-radius-of-picked-actor-vtkspheresource/4838
**Category:** Support
**Created:** [December 16, 2020, 4:40pm UTC](https://discourse.vtk.org/t/change-the-radius-of-picked-actor-vtkspheresource/4838 "2020-12-16T16:40:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Travis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/travis/32/2752_2.png) [@Travis](https://discourse.vtk.org/u/Travis)
#### Post date: [December 16, 2020, 4:40pm UTC](https://discourse.vtk.org/t/change-the-radius-of-picked-actor-vtkspheresource/4838/1 "2020-12-16T16:40:51Z")

</div>

Hi,  
I’m following this example  
[https://lorensen.github.io/VTKExamples/site/Python/Picking/HighlightPickedActor/](https://lorensen.github.io/VTKExamples/site/Python/Picking/HighlightPickedActor/)  
which shows how to change color of the picked actor which is a `vtkSphereSource`. However, how is it possible to change the radius of the picked actor? there isn’t any `SetRadius` in the properties of the actors. How can I reach to the source from the actor? I’m thinking something like `actor.GetMapper().GetSource().SetRadius()` but there is no `GetSource`, I tried `GetInputData` too which doesn’t led me to the place I can `SetRadius`

Thanks

---

<div class="post-metadata">

### Author: ![Travis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/travis/32/2752_2.png) [@Travis](https://discourse.vtk.org/u/Travis)
#### Post date: [December 17, 2020, 5:42pm UTC](https://discourse.vtk.org/t/change-the-radius-of-picked-actor-vtkspheresource/4838/2 "2020-12-17T17:42:40Z")

</div>

I have found this example here which is written in C++, I’m interested in VTK Javascript or Python, There is not a `getProducer` for `actor.getMapper().getInputData()` as I saw.

[https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ReverseAccess](https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ReverseAccess)

```
//
// Now we retrieve the source object from vtkActor reversely, 
// meaning we don't use the spheresource object we instantiated
// above directly, 
// instead we retrieve a reference to the spheresource through the
// actor.
// An advantage of this concept might be that we don't need to
// maintain the source object anymore 
// in a more complex application.
// To demonstrate that we can modify properties of the spheresource
// through this reference
// beside changing some properties of the actor (in this example we
// change actor's x-position), 
// we change the radius of the spheresource as well.
//
// next two lines are the core lines for reverse access
//
vtkSmartPointer<vtkAlgorithm> algorithm =
  sphereActor->GetMapper()->GetInputConnection(0, 0)->GetProducer();
vtkSmartPointer<vtkSphereSource> srcReference =
  vtkSphereSource::SafeDownCast(algorithm);

float origRadius = srcReference->GetRadius();
for (int i = 0; i < 360; ++i)
  {
  // change radius of the spheresource
  srcReference->SetRadius(origRadius * (1 + sin((float)i/180.0 * vtkMath::Pi())));
  // change x-position of the actor
  sphereActor->SetPosition(sin((float)i/45.0 * vtkMath::Pi())*0.5, 0, 0);
  renWin->Render();
  }
    
//
// Thanks to the usage of vtkSmartPointer there is no explicit need
// to free any objects at this point.
//
return EXIT_SUCCESS;
```

---

<div class="post-metadata">

### Author: ![Travis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/travis/32/2752_2.png) [@Travis](https://discourse.vtk.org/u/Travis)
#### Post date: [January 11, 2021, 1:31pm UTC](https://discourse.vtk.org/t/change-the-radius-of-picked-actor-vtkspheresource/4838/3 "2021-01-11T13:31:09Z")

</div>

bump

---

<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: [February 21, 2021, 1:59pm UTC](https://discourse.vtk.org/t/change-the-radius-of-picked-actor-vtkspheresource/4838/4 "2021-02-21T13:59:55Z")

</div>

Hi, Travis,

You can try changing the actor’s scale with, for example, `myActor.setScale(2.0, 2.0, 2.0)`. This will double the sphere’s radius as rendered.

regards,

Paulo
