Drop down list error

Dear all ,

I’m trying to do a Programmable Filter with a dynamic drop down list, where the displayed properties in the GUI depend on the selected option in the drop down list (See cases A and B in the next figure):

image

So far, I succeeding in creating this interface in the filter, i.e., this dynamic drop down list appear when I apply the filter and I obtain the cases A and B from the figure. You can check this by using the attached PVSM file (it requires first to load the plugin -xml file-).

However, when I click on the “Apply” button, there is an error related to the XML file:

Object type: vtkPythonProgrammableFilter, could not find requested method: “SetParameter” or the method was called with incorrect arguments.

I have the feeling that the error come from line 80 (XML file) because I used command=“SetParameter” whereas in the original example (https://github.com/themiwi/ParaView/blob/master/Examples/Plugins/ParametricSource/ParametricSource.xml) it is used “SetParametricFunction”.

Do you have any idea to solve this problem?

Thanks in advance.

Miguel Angel AGUIRRE

DROP_DOWN_ERROR.pvsm (292.5 KB) DROP_DOWN_LIST_TEST.xml (2.6 KB) PV_ERROR_TEST.cas (298.6 KB) PV_ERROR_TEST.dat (491.3 KB)

Is this a C++ ou python plugin ?

Hello,

Yes, it is a Python plugin.

By the way, I omitted the python file for simplicity. In fact, in line 72 it let:
default_values=“print Method_1”>

but it could also be:
default_values=“execfile(‘C:/FilePath/Python_File.py’)”>

Thanks again

Miguel

All versions of vtkPythonProgrammableFilter::SetParameter() take two arguments. You are providing one, hence the error message.

Note that the ParametricSource example does not use the vtkPythonProgrammableFilter but an entirely different VTK class, so it is not a useful reference. Take a look at https://github.com/wildmichael/ParaView/blob/master/Examples/Plugins/HelixSource/helix.xml instead to see how to use SetParameter().

Hello,

Thanks for your answer.

However, I’m still struggling with this. The HelixSource example does not have a dynamic drop down list (just several classical “StringVectorProperty”). My XML code is quite different because it uses “ProxyProperty” to call the drop down list (Very similar to this example: http://the-unofficial-paraview-developers-forum.34153.x6.nabble.com/InputArrayDomain-not-working-as-expected-from-proxylist-td4967.html). My code is shown below.

In several forums I found that the command for the ProxyProperty is “Set+name” (i.e., if name=“Selection”, then command=“SetSelection”). I tried also this but it still not working.
I’m confident about the first proxy group (“DropDownList”) because I can see that PV displays what I code there. However, the problem is in the second proxy group (“filters”), and more precisely in ProxyProperty, but I can not figure it out.

Any clue is welcomed. Thanks for your time!

Miguel

<!-- Here is defined the drop down list	for the GUI -->
<ProxyGroup name="DropDownList">
	<Proxy name="All_methods" class="vtkPythonProgrammableFilter">
			
		<IntVectorProperty 
			name="Method_A"
			command="SetParameter"
			initial_string="Method_A"
			number_of_elements="1"
			default_values="1">
			<BooleanDomain name="bool"/>
		</IntVectorProperty>
		
		<IntVectorProperty 
			name="Method_B"
			command="SetParameter"
			initial_string="Method_A"
			number_of_elements="1"
			default_values="1">
			<BooleanDomain name="bool"/>
		</IntVectorProperty>
		
	</Proxy>
	
	
	<Proxy name="None" class="vtkPythonProgrammableFilter">
	</Proxy>
	
	
	<Proxy name="Select_Method" class="vtkPythonProgrammableFilter">

		<IntVectorProperty 
			name="Method_1"
			command="SetParameter"
			initial_string="Method_1"
			number_of_elements="1"
			default_values="0">
			<BooleanDomain name="bool"/>
		</IntVectorProperty>
	  
		<IntVectorProperty 
			name="Method_2"
			command="SetParameter"
			initial_string="Method_2"
			number_of_elements="1"
			default_values="0">
			<BooleanDomain name="bool"/>
		</IntVectorProperty>

	</Proxy>
</ProxyGroup>

<ProxyGroup name="filters">
	<SourceProxy name="DROP_DOWN_LIST_TEST" 
				class="vtkPythonProgrammableFilter" 
				label="DROP_DOWN_LIST_TEST">
				
			<!-- Define the input port with data to be processed -->
			<InputProperty
				name="Input"
				command="SetInputConnection">
				<ProxyGroupDomain name="groups">
					<Group name="sources"/>
					<Group name="filters"/>
				</ProxyGroupDomain>
				<DataTypeDomain name="input_type">
					<DataType value="vtkDataSet"/>
				</DataTypeDomain>
			</InputProperty>
			
			<!-- Define the Paraview data set type as "Same as Input" (default value of 8 means "Same as Input") -->
			<IntVectorProperty 
				name="OutputDataSetType" 
				command="SetOutputDataSetType" 
				number_of_elements="1"
				default_values="8"
				panel_visibility="never"> 
			</IntVectorProperty>			
			
			<!-- Execute the Python script :	-->
			<StringVectorProperty 
				name="Script" 
				command="SetScript"
				number_of_elements="1"
				default_values="print Method_1">
				<Hints>
					<Widget type="multi_line"/>
				</Hints>
			</StringVectorProperty>
				
			<!-- Include the drop down list	-->
			<ProxyProperty
				name="Selection"
				command="SetSelection">
				<ProxyListDomain name="proxy_list">
					<Proxy group="DropDownList" name="All_methods" />
					<Proxy group="DropDownList" name="Select_Method" />
					<Proxy group="DropDownList" name="None" />
				</ProxyListDomain>
			</ProxyProperty>
 

	 
	</SourceProxy>
</ProxyGroup>