[Paraview] Custom Python plugin with multiple input ports

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Fri Jul 15 15:20:10 EDT 2016


Doh! I forgot that the number of ports need to set in the constructor of
the vtkAlgorithm subclass. Grr...let me see if there's a workaround. I'll
get back to you on it.

On Fri, Jul 15, 2016 at 2:37 PM, LB <bravo.loic at gmail.com> wrote:

> Hi Utkarsh,
>
> Multiple input ports are exactly what I want.
> But I can't get it to work. I've attached my last XML plugin attempt with
> different port_index definition.
>
> When I try to use it, I have the following error:
>
> /ParaViewVTK/Common/ExecutionModel/vtkAlgorithm.cxx, line 893
>
> vtkPythonProgrammableFilter (0x6c7a510): Attempt to connect input port
> index 1 for an algorithm with 1 input ports.
>
> Should I add something to tell ParaView that this filter has multiple
> input ports?
> Should I use a different class than the vtkPythonProgrammableFilter?
>
> Regards,
> --
> Loïc
>
> 2016-07-15 17:36 GMT+02:00 Utkarsh Ayachit <utkarsh.ayachit at kitware.com>:
>
>> Sorry for chiming in late, but here are some things to note:
>>
>> * Both Dennis and Cory are talking about multiple connections on the
>> same input port. This is arguably not too well supported since the
>> order cannot be determined easily.
>> * Seems to me you want multiple input ports, each with a single
>> connection. That's supported. Just not by the Python Filter Generator
>> Script. Once you have the XML for the filter, you can indeed just add
>> another <InputProperty /> tag to it as follows (note the "port_index"
>> attribute):
>>
>> <InputProperty command="SetInputConnection"
>>                          name="Input2"
>>                          port_index="2">
>>    <!-- fill with relevant domain information -->
>> </InputProperty>
>>
>> Then, your python filter code can access data on each input port as:
>>
>> input1 = self.GetInputDataObject(0, 0)
>> input2 = self.GetInputDataObject(1, 0)
>>
>> Here there's no confusion which data is on which input port.
>>
>> Hope that helps,
>> Utkarsh
>>
>>
>> On Fri, Jul 15, 2016 at 7:44 AM, Dennis Conklin
>> <dennis_conklin at goodyear.com> wrote:
>> > LB,
>> >
>> >
>> >
>> > Yes, it is troublesome to not be able to tell which input is which
>> inside
>> > the Programmable filter.     Something I have done in the past is
>> > differentiate them inside the filter.   I have tested for element type
>> to
>> > tell them apart, for example.  Something else I have heard of but have
>> not
>> > had to use is assigning a unique variable to one input and then testing
>> for
>> > that inside the filter to determine which input is which.
>> >
>> >
>> >
>> > None of this may address  your general problem, but here’s hoping.
>> >
>> >
>> >
>> > Dennis
>> >
>> >
>> > _______________________________________________
>> > 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 ParaView Wiki at:
>> > http://paraview.org/Wiki/ParaView
>> >
>> > Search the list archives at: http://markmail.org/search/?q=ParaView
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://public.kitware.com/mailman/listinfo/paraview
>> >
>> _______________________________________________
>> 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 ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/paraview
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160715/975e60da/attachment.html>


More information about the ParaView mailing list