<div dir="ltr">Hi, for those interested, I've come up with an easy partial solution, being this the implementation:<div><br></div><div><div> <font face="monospace, monospace"><IntVectorProperty</font></div><div><font face="monospace, monospace"> clean_command="ClearParameter"</font></div><div><font face="monospace, monospace"> command="SetParameter"</font></div><div><font face="monospace, monospace"> name="BlockIndices"</font></div><div><font face="monospace, monospace"> label="Block Indices"</font></div><div><font face="monospace, monospace"> initial_string="BlockIndices"</font></div><div><font face="monospace, monospace"> animateable="1"</font></div><div><font face="monospace, monospace"> default_values="1"</font></div><div><font face="monospace, monospace"> number_of_elements_per_command="1"</font></div><div><font face="monospace, monospace"> repeat_command="0" ></font></div><div><font face="monospace, monospace"> <CompositeTreeDomain</font></div><div><font face="monospace, monospace"> mode="all"</font></div><div><font face="monospace, monospace"> name="tree"></font></div><div><font face="monospace, monospace"> <RequiredProperties></font></div><div><font face="monospace, monospace"> <Property function="Input"</font></div><div><font face="monospace, monospace"> name="Input" /></font></div><div><font face="monospace, monospace"> </RequiredProperties></font></div><div><font face="monospace, monospace"> </CompositeTreeDomain></font></div><div><font face="monospace, monospace"> <Documentation></Documentation></font></div><div><font face="monospace, monospace"> </IntVectorProperty></font></div></div><div><br></div><div>This property allows the user to select only ONE block from the composite tree domain. After digging into the vtkPythonProgrammableFilter class I discovered that the method <font face="monospace, monospace">AddParameter()</font>, which would be ideal for this case, takes only string values as arguments, whereas the vtkCompositeTreeDomain only works within a vtkIntVectorProperty (integer values), hence it's not possible to use it.</div><div><br></div><div>On the other hand, the method <span style="font-family:monospace,monospace">SetParameter()</span><font face="arial, helvetica, sans-serif"> only allows more than one value (up to three) in the arguments if they are of the type double. In the case of integer values, only one value is accepted. Therefore, even if the user checks more than one block, only the last index is stored. In the snippet of code above the user is not allowed to check more than one block by setting </font><span style="font-family:monospace,monospace">repeat_command</span><font face="arial, helvetica, sans-serif"> to 0.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I hope that this will be useful for future enquiries, and if someone comes up with a better workaround that actually allows selecting as many blocks as desired please let me know!</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Jorge</font></div><div class="gmail_extra"><br><div class="gmail_quote">On 16 July 2016 at 13:40, Andy Bauer <span dir="ltr"><<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">You need to add in those methods. Look at the vtkExtractBlock.cxx/h class to see how those methods are being used in ParaView.<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 15, 2016 at 11:31 AM, Jorge Bañuls <span dir="ltr"><<a href="mailto:jorgebanuls@gmail.com" target="_blank">jorgebanuls@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">I've tried to implement the property in this way:<div><br></div><div><span style="font-size:12.8px"> <font face="monospace, monospace"><IntVectorProperty clean_command="</font></span><font face="monospace, monospace"><span style="font-size:12.8px">RemoveAllIndices"</span><br style="font-size:12.8px"><span style="font-size:12.8px"> command="AddIndex"</span><br style="font-size:12.8px"><span style="font-size:12.8px"> name="BlockIndices"</span><br style="font-size:12.8px"><span style="font-size:12.8px"> number_of_elements_per_</span><span style="font-size:12.8px">command="1"</span><br style="font-size:12.8px"><span style="font-size:12.8px"> panel_visibility="default"</span><br style="font-size:12.8px"><span style="font-size:12.8px"> repeat_command="1"></span><br style="font-size:12.8px"><span style="font-size:12.8px"> <CompositeTreeDomain mode="all"</span><br style="font-size:12.8px"><span style="font-size:12.8px"> name="tree"></span><br style="font-size:12.8px"><span style="font-size:12.8px"> <RequiredProperties></span><br style="font-size:12.8px"><span style="font-size:12.8px"> <Property function="Input"</span><br style="font-size:12.8px"><span style="font-size:12.8px"> name="Input" /></span><br style="font-size:12.8px"><span style="font-size:12.8px"> </RequiredProperties></span><br style="font-size:12.8px"><span style="font-size:12.8px"> </CompositeTreeDomain></span><br style="font-size:12.8px"><span style="font-size:12.8px"> <Documentation></span><span style="font-size:12.8px"></Documentation></span><br style="font-size:12.8px"><span style="font-size:12.8px"> </IntVectorProperty></span></font><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">but I get the following error:</span></div><div><span style="font-size:12.8px"><br></span></div><div><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">ERROR: In M:\b\paraview\src\paraview\ParaViewCore\ServerImplementation\Core\vtkPVSessionCore.cxx, line 390</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">vtkPVSessionCore (00000000035C2B60): Object type: vtkPythonProgrammableFilter, could not find requested method: "RemoveAllIndices"</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">or the method was called with incorrect arguments.</span></p>
<p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">while processing</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">Message 0 = Invoke</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"> Argument 0 = vtk_object_pointer {vtkPythonProgrammableFilter (000000000B5222A0)}</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"> Argument 1 = string_value {RemoveAllIndices}</span></p>
<p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></p>
<p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></p>
<p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">ERROR: In M:\b\paraview\src\paraview\ParaViewCore\ServerImplementation\Core\vtkPVSessionCore.cxx, line 391</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">vtkPVSessionCore (00000000035C2B60): Aborting execution for debugging purposes.</span></p>
<p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></p>
<p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">ERROR: In M:\b\paraview\src\paraview\ParaViewCore\ServerImplementation\Core\vtkSIProxy.cxx, line 134</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">vtkSISourceProxy (000000000B4FDA70): Error pushing property state: BlockIndices</span></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></span></p><div><span style="font-size:12.8px">if I omit <font face="monospace, monospace">clean_command="RemoveAllIndices"</font>, then the error appears for <font face="monospace, monospace">command="AddIndex"</font>. I've tried to use other commands, such as SetParameter or AddParameter, but no combination seems to work.</span></div></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 July 2016 at 12:27, Andy Bauer <span dir="ltr"><<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>In ./ParaViewCore/ServerManager/SMApplication/Resources/filters.xml in the source code there's the following section which gives the options and GUI layout:<br> <SourceProxy class="vtkExtractBlock"<br> label="Extract Block"<br> name="ExtractBlock"><br> <Documentation long_help="This filter extracts a range of blocks from a multiblock dataset."<br> short_help="Extract block.">This filter extracts a range<br> of groups from a multiblock dataset</Documentation><br> <InputProperty command="SetInputConnection"<br> name="Input"><br> <ProxyGroupDomain name="groups"><br> <Group name="sources" /><br> <Group name="filters" /><br> </ProxyGroupDomain><br> <DataTypeDomain name="input_type"><br> <DataType value="vtkMultiBlockDataSet" /><br> </DataTypeDomain><br> <Documentation>This property specifies the input to the Extract Group<br> filter.</Documentation><br> </InputProperty><br> <IntVectorProperty clean_command="RemoveAllIndices"<br> command="AddIndex"<br> name="BlockIndices"<br> number_of_elements_per_command="1"<br> panel_visibility="default"<br> repeat_command="1"><br> <CompositeTreeDomain mode="all"<br> name="tree"><br> <RequiredProperties><br> <Property function="Input"<br> name="Input" /><br> </RequiredProperties><br> </CompositeTreeDomain><br> <Hints><br> <WidgetHeight number_of_rows="20" /><br> </Hints><br> <Documentation>This property lists the ids of the blocks to extract<br> from the input multiblock dataset.</Documentation><br> </IntVectorProperty><br> <IntVectorProperty command="SetPruneOutput"<br> default_values="1"<br> name="PruneOutput"<br> number_of_elements="1"><br> <BooleanDomain name="bool" /><br> <Documentation>When set, the output mutliblock dataset will be pruned<br> to remove empty nodes. On by default.</Documentation><br> </IntVectorProperty><br> <IntVectorProperty command="SetMaintainStructure"<br> default_values="0"<br> name="MaintainStructure"<br> number_of_elements="1"><br> <BooleanDomain name="bool" /><br> <Documentation>This is used only when PruneOutput is ON. By default,<br> when pruning the output i.e. remove empty blocks, if node has only 1<br> non-null child block, then that node is removed. To preserve these<br> parent nodes, set this flag to true.</Documentation><br> </IntVectorProperty><br> <!-- End ExtractBlock --><br> </SourceProxy><br><br></div>Creating something similar for you may work. If you search the code for things like vtkSMIntVectorProperty.cxx/h you should find information on how the corresponding IntVectorProperty.<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 15, 2016 at 7:18 AM, Jorge Bañuls <span dir="ltr"><<a href="mailto:jorgebanuls@gmail.com" target="_blank">jorgebanuls@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Hi Andy,<br><br></div>Indeed, the vtkExtractBlock filter is what I'm using in my script to extract the blocks, which are currently specified by the user in the properties panel as a string with the name of the block(s). Now that you mention it though, it could be useful to see how this filter creates the checklist. Is there a way to access the code behind this filter?<br><br></div>Thanks a lot for your help,<br><br></div>Jorge Bañuls<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 July 2016 at 12:06, Andy Bauer <span dir="ltr"><<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Have you looked at the Extract Blocks filter? That may already be doing what you need and if not, it at least shows how to check the boxes for blocks that you want.<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Fri, Jul 15, 2016 at 6:53 AM, Jorge Bañuls <span dir="ltr"><<a href="mailto:jorgebanuls@gmail.com" target="_blank">jorgebanuls@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div><div><div>Hi,<br><br></div>I'm developing a filter for Paraview and I need to be able to select blocks from the properties panel (the input is a vtkMultiBlockDataSet). The approach I'm using right now is to write the name of the block(s) and then process that string within the script, but I would like to be able to check the blocks I need from a list. I've seen many examples of how to do this, but only for variables arrays (e.g. the list displays the cell arrays existing in the input). Any ideas on how to apply this to display and select the blocks?<br><br></div>Thanks in advance for your help,<br><br></div>Jorge Bañuls<br></div>
<br></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 <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=Paraview-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=Paraview-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview-developers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>