[Paraview-developers] How to find the selected object?

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Oct 22 15:40:38 EDT 2014


The easiest way would be as follows:

vtkSMProxySelectionModel* selModel = pqActiveObjects::instance().
activeSourcesSelectionModel();
for (unsigned int cc=0, max = selModel->GetNumberOfSelectedProxies();
      cc<max; cc++)
  {
  vtkSMProxy* item = selModel->GetSelectedProxy(cc);
  // item can be a vtkSMSourceProxy or a vtkSMOutputPort.
  }

Utkarsh

On Mon, Sep 29, 2014 at 10:46 AM, Ronald Römer <rroemer at gmail.com> wrote:
> This sounds interesting! Could you write a snippet of how to get the
> selected sources from the pipeline browser? Let us assume that a user
> selects two sources. What's the simplest way to get both output-ports? I
> could use this information for my plugin, that consumes two polydata inputs.
> Currently a dialog is opened, where the user must select the second input.
> This takes too much time ...
>
> Thanks.
>
> Am 29.09.2014 15:00 schrieb "Utkarsh Ayachit" <utkarsh.ayachit at kitware.com>:
>
>> Depends on what you mean by "selection". If you're referring to the
>> selection in the Pipeline browser i.e. the "active" source, then use
>> pqActiveObjects [1]. If you're looking for selection by
>> clicking/selecting in the render view, pqSelectionManager [2]. [1]
>> Would often suffice for [2] too depending on what you're looking for
>> to do once you've determined what was selected since selecting in
>> render view, also makes the source active.
>>
>> Utkarsh
>>
>> [1]
>> http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classpqActiveObjects.html
>> [2]
>> http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classpqSelectionManager.html
>>
>> On Fri, Sep 26, 2014 at 1:05 PM, B.W.H. van Beest <bwvb at xs4all.nl> wrote:
>> > Hello,
>> >
>> > I'm trying to build my own plugin (C++) in Paraview.
>> > I wonder how one can programattically find which object (point, box,
>> > sphere, ... etc) is selected/clicked by a user.
>> >
>> > Any hint is much appreciated.
>> >
>> > Regards,
>> > Bertwim
>> >
>> >
>> > _______________________________________________
>> > Paraview-developers mailing list
>> > Paraview-developers at paraview.org
>> > http://public.kitware.com/mailman/listinfo/paraview-developers
>> _______________________________________________
>> Paraview-developers mailing list
>> Paraview-developers at paraview.org
>> http://public.kitware.com/mailman/listinfo/paraview-developers


More information about the Paraview-developers mailing list