[vtkusers] Actor -- isMovable?

Karthik Krishnan karthik.krishnan at kitware.com
Wed Nov 4 12:25:17 EST 2009


try to disable the interactor style set on teh interactor

interactor->GetInteractorStyle()->EnabledOff()

On Wed, Nov 4, 2009 at 10:35 AM, Piotr Byzia <piotr.byzia at gmail.com> wrote:

> Cory and Karthik,
>
> Thank you for your suggestions.
>
> By moving, I meant an interaction with a mouse.
> Indeed, I have no interaction style defined explicitly, but it seems that
> Python interface has some default one set up, because I was able to run
> this:
>
> lines_actor.PickableOff()
> print lines_actor.GetPickable()
> lines_actor.PickableOn()
> print lines_actor.GetPickable()
> lines_actor.SetPickable(0)
> print lines_actor.GetPickable()
>
> which produced:
> 0
> 1
> 0
>
> (I apologize if this is something obvious for you, I just started
> experimenting with VTK)
> So, vtkActor() has an interaction style by default, thus I was able to call
> PickableOff() on it.
> However it does not work, while I was able to pick and move around (rotate)
> lines_actor with the mouse.
>
> I had the same issue with lines_actor.DragableOff().
>
> What is surprising, lines_actor.VisibilityOff() works fine! (lines_actor
> was not visible on the scene)
>
> Do you possibly have ideas what can interfere with the PickableOff() ??
>
> Thanks for any suggestions,
> Piotr Byzia
>
>
>
> On 04.11.2009, at 14:16, Cory Quammen wrote:
>
>  Hi Piotr,
>>
>> Perhaps you could clarify what you mean by moving an actor. It doesn't
>> sound like you have an interactor style that is manipulating the
>> actors by picking with the mouse. If you did, however, you could call
>> PickableOff() on the actor, which will prevent you from picking it and
>> thereby prevent movement of the actor.
>>
>> How exactly are you moving the actors now?
>>
>> Cory
>>
>> On Wed, Nov 4, 2009 at 7:21 AM, Piotr Byzia <piotr.byzia at gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I want to set an actor to be movable or non-movable, depending on
>>> settings
>>> which I control through PyQT GUI.
>>> In other words, having a few actors on the scene I want to set checkboxes
>>> in
>>> my GUI that would freeze a given actor, and the rest of them to react as
>>> usual to the mouse movements / clicks.
>>>
>>> Regarding visibility of the actor I'm using GetProperty().SetOpacity(0.0)
>>> on
>>> an instance of any given actor.
>>> I can't see anything related to movement in the GetProperty() properties,
>>> I
>>> believe it's somewhere else?
>>>
>>> Here are most important parts of the code I'm using to generate a single
>>> actor:
>>>
>>> self.ren = vtk.vtkRenderer()
>>> self.ren.SetBackground(0, 0, 0)
>>> self.widget_3d.GetRenderWindow().AddRenderer(self.ren)
>>>
>>> apd=vtk.vtkAppendPolyData()
>>>
>>> for i in xrange(len(coordinates)):
>>>   line=vtk.vtkLineSource()
>>>
>>>   line.SetPoint1(coordinates[i][0]) # 1st atom coordinates for a given
>>> bond
>>>   line.SetPoint2(coordinates[i][1]) # 2nd atom coordinates for a given
>>> bond
>>>   line.SetResolution(21)
>>>   apd.AddInput(line.GetOutput())
>>>
>>> mapper = vtk.vtkPolyDataMapper()
>>> mapper.SetInput(apd.GetOutput())
>>> lines_actor = vtk.vtkActor()
>>> lines_actor.SetMapper(mapper)
>>> lines_actor.GetProperty().SetColor(0.7, 0.0, 0.0)
>>> lines_actor.GetProperty().SetOpacity(1.0)
>>>
>>> self.ren.AddActor(lines_actor)
>>>
>>>
>>> I found SetCurrentStyleToTrackballActor(), but I want to control this
>>> behavior from my GUI.
>>> Besides, trackball mode is very inconvenient in my case, with molecules
>>> in
>>> "lines" representation (it's hard to pick a single line).
>>>
>>> Thanks,
>>> Piotr Byzia
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>>
>> --
>> Cory Quammen
>> Center for Computer Integrated Systems for Microscopy and Manipulation
>> (CISMM)
>> Department of Computer Science
>> University of North Carolina at Chapel Hill
>> http://www.cs.unc.edu/~cquammen <http://www.cs.unc.edu/%7Ecquammen>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091104/d994654f/attachment.htm>


More information about the vtkusers mailing list