Attached a fixed version. I've also change the "Script" to just print
the value for sFields which is a array of selected array names. You'll
need to update your code accordingly. Note, if the user selected
nothing then sFields will not be defined. So you may want to handle
that in your code as well.
On Mon, Jun 27, 2016 at 1:30 PM, Dean Neumann <[email protected]> wrote:
> Fellas, can someone please point me to examples (current as of v5.0.1) of
> how a PythonProgrammableFilter accesses the values of properties entered via
> a DropDownList on the filter's Properties panel....
>
> I have written a Python programmable filter which extracts user-specified
> field arrays from user-specified blocks of multiple (MultiBlock) input
> datasets. I use this to perfrom statistical analysis of values from many
> different simulatyions.
> The filter works fine when the field array names and block numbers are
> hardcoded in the script.
> .
> Then I used Pat Marion's python_filter_generator.py to wrap the filter in
> XML and allow these values to be entered via TextBoxes in the Properties
> panel. That also works fine. The property TextBoxes are accessible to the
> Python script and I can retrieve the user-entered values.
>
> Then I attempted to change the field array input widget from a textbox to a
> DropDownList of cell arrays with checkboxes for selection, following the
> example in
> http://www.paraview.org/Wiki/ParaView/Plugin_HowTo#Drop_down_list. The
> DropDownList does appear correctly, populated correctly, along with
> checkboxes for selecting items from the list. However when I hit Apply I
> get the following error:
>
>>>
>>> ERROR: In
>>> C:\bbd\5105004d\build\paraview\src\paraview\ParaViewCore\ServerImplementation\Core\vtkPVSessionCore.cxx,
>>> line 390
>>>
>>> vtkPVSessionCore (00000000036E8610): Object type:
>>> vtkPythonProgrammableFilter, could not find requested method:
>>> "SetCellArrayStatus"
>>>
>>> or the method was called with incorrect arguments.
>>>
>>>
>>> while processing
>>>
>>> Message 0 = Invoke
>>>
>>> Argument 0 = vtk_object_pointer {vtkPythonProgrammableFilter
>>> (000000000D1BCCD0)}
>>>
>>> Argument 1 = string_value {SetCellArrayStatus}
>>>
>>> Argument 2 = string_value {cellInputs}
>>>
>>> Argument 3 = int32_value {0}
>>>
>>>
>>> ERROR: In
>>> C:\bbd\5105004d\build\paraview\src\paraview\ParaViewCore\ServerImplementation\Core\vtkPVSessionCore.cxx,
>>> line 391
>>>
>>> vtkPVSessionCore (00000000036E8610): Aborting execution for debugging
>>> purposes.
>>>
>>>
>>> ERROR: In
>>> C:\bbd\5105004d\build\paraview\src\paraview\ParaViewCore\ServerImplementation\Core\vtkSIProxy.cxx,
>>> line 134
>>>
>>> vtkSISourceProxy (000000000A29BFE0): Error pushing property state:
>>> CellArrayStatus
>
>
> I looked at the examples in
> ParaView/ParaViewCore/ServerManager/SMApplication/Resources/readers.xml as
> suggested, but nowhere do I see examples of how a Python script accesses the
> user's selections (only examples of the XML code is shown, not the Python
> scripts). I also perused the site-packages subdirectory of my installation,
> but those are all compiled Python and of no help.
>
> I'm sure if I just see some Python code examples I can get this working. I
> have attached my filter if that helps...
> many thanks for your help.
>
> Dean Neumann
> CEO, Malaspina Lans Inc
>
>
> _______________________________________________
> 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
>
<ServerManagerConfiguration>
<ProxyGroup name="filters">
<SourceProxy name="SliceAcrossDatasets" class="vtkPythonProgrammableFilter" label="Slice Across Datasets">
<Documentation
long_help="extract the specified arrays from the specified blocks of multiple input datasets. Output as VTKTable (RowData)"
short_help="extract the specified arrays from the specified blocks of multiple input datasets. Output as VTKTable (RowData)">
</Documentation>
<InputProperty
name="Input"
clean_command="RemoveAllInputs"
command="AddInputConnection"
multiple_input="1">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkMultiBlockDataSet"/>
</DataTypeDomain>
</InputProperty>
<StringVectorProperty
name="sBlocks"
label="Blocks to Extract"
initial_string="sBlocks"
command="SetParameter"
animateable="1"
default_values="1, 2"
number_of_elements="1">
<Documentation></Documentation>
</StringVectorProperty>
<StringVectorProperty
name="sFields"
label="Fields to Extract"
initial_string="sFields"
command="AddParameter"
clean_command="ClearParameter"
number_of_elements_per_command="1"
repeat_command="1" >
<Documentation></Documentation>
<ArrayListDomain name="array_list"
attribute_type="Scalars"
input_domain_name="inputs_array">
<RequiredProperties>
<Property name="Input"
function="Input" />
</RequiredProperties>
</ArrayListDomain>
</StringVectorProperty>
<!-- Output data type: "vtkTable" -->
<IntVectorProperty command="SetOutputDataSetType"
default_values="19"
name="OutputDataSetType"
number_of_elements="1"
panel_visibility="never">
<Documentation>The value of this property determines the dataset type
for the output of the programmable filter.</Documentation>
</IntVectorProperty>
<StringVectorProperty
name="Script"
command="SetScript"
number_of_elements="1"
default_values="print sFields"
panel_visibility="advanced">
<Hints>
<Widget type="multi_line"/>
</Hints>
<Documentation>This property contains the text of a python program that
the programmable source runs.</Documentation>
</StringVectorProperty>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
_______________________________________________
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