<div dir="ltr"><div><div><div><div><div><div>Thanks Utkarsh!<br><br></div>It's a neat hack, and it will fit my problem perfectly.<br><br></div>The dark side of this patch is that you are limited to one or two inputs ports.  It would not be possible to create more complex filter like, for example, the vtkLandmarkTransformFilter (which needs 3 separate input ports).<br></div><br>To respond to the feature request mentioned by Cory, it would be nice to have more flexibility. It would be nice to define the number of input ports directly in the XML plugin file.<br><br></div>Do you think it could be possible?<br><br></div>Regards,<br><br>-- <br></div>Loïc<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-18 16:06 GMT+02:00 Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The attached patch for vtkPythonProgrammableFilter along with a minor tweak to your plugin XML does the trick. I can have this cleaned up and merged in "master" for 5.2 if that's acceptable.<span class="HOEnZb"><font color="#888888"><div><br></div><div>Utkarsh</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 15, 2016 at 3:20 PM, Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 15, 2016 at 2:37 PM, LB <span dir="ltr"><<a href="mailto:bravo.loic@gmail.com" target="_blank">bravo.loic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Utkarsh,<br><br></div>Multiple input ports are exactly what I want.<br></div>But I can't get it to work. I've attached my last XML plugin attempt with different port_index definition.<br></div><br>When I try to use it, I have the following error:<br>

<p style="margin:0px;text-indent:0px"><span style="font-family:"Courier";font-size:9pt;color:rgb(128,0,0)">/ParaViewVTK/Common/ExecutionModel/vtkAlgorithm.cxx, line 893</span></p>
<p style="margin:0px;text-indent:0px"><span style="font-family:"Courier";font-size:9pt;color:rgb(128,0,0)">vtkPythonProgrammableFilter (0x6c7a510): Attempt to connect input port index 1 for an algorithm with 1 input ports.</span></p><br><div>Should I add something to tell ParaView that this filter has multiple input ports?<br></div><div>Should I use a different class than the vtkPythonProgrammableFilter? <br><div><div><br></div><div>Regards,<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div>-- <br></div><div>Loïc<br></div></font></span></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-15 17:36 GMT+02:00 Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry for chiming in late, but here are some things to note:<br>
<br>
* Both Dennis and Cory are talking about multiple connections on the<br>
same input port. This is arguably not too well supported since the<br>
order cannot be determined easily.<br>
* Seems to me you want multiple input ports, each with a single<br>
connection. That's supported. Just not by the Python Filter Generator<br>
Script. Once you have the XML for the filter, you can indeed just add<br>
another <InputProperty /> tag to it as follows (note the "port_index"<br>
attribute):<br>
<br>
<InputProperty command="SetInputConnection"<br>
                         name="Input2"<br>
                         port_index="2"><br>
   <!-- fill with relevant domain information --><br>
</InputProperty><br>
<br>
Then, your python filter code can access data on each input port as:<br>
<br>
input1 = self.GetInputDataObject(0, 0)<br>
input2 = self.GetInputDataObject(1, 0)<br>
<br>
Here there's no confusion which data is on which input port.<br>
<br>
Hope that helps,<br>
Utkarsh<br>
<div><div><br>
<br>
On Fri, Jul 15, 2016 at 7:44 AM, Dennis Conklin<br>
<<a href="mailto:dennis_conklin@goodyear.com" target="_blank">dennis_conklin@goodyear.com</a>> wrote:<br>
> LB,<br>
><br>
><br>
><br>
> Yes, it is troublesome to not be able to tell which input is which inside<br>
> the Programmable filter.     Something I have done in the past is<br>
> differentiate them inside the filter.   I have tested for element type to<br>
> tell them apart, for example.  Something else I have heard of but have not<br>
> had to use is assigning a unique variable to one input and then testing for<br>
> that inside the filter to determine which input is which.<br>
><br>
><br>
><br>
> None of this may address  your general problem, but here’s hoping.<br>
><br>
><br>
><br>
> Dennis<br>
><br>
><br>
</div></div><div><div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the ParaView Wiki at:<br>
> <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>