All,

So, I can load the xml plugin but the filter is grayed out on the Filters menu. 
  I have tried removing the InputDataSetType so that it should accept any type 
of input, but still gray.   I am not sure how Paraview decides which filters 
are inappropriate (greyed-out) so I don’t have many ideas on how to overcome 
this.

I loaded the  TestFilter.xml from the blog and that is also greyed-out.    I 
loaded the DoubleHelixSource.xml and that is available in the Sources menu and 
runs.

Thanks

Dennis

From: Dennis Conklin
Sent: Thursday, September 24, 2015 3:18 PM
To: 'Cory Quammen' <[email protected]>
Cc: Paraview ([email protected]) <[email protected]>
Subject: RE: [EXT] Re: [Paraview] More Customization of Python programmable 
Filter Panel

Cory,

I had just thought of this and tried it (successfully) about when your note 
came in.

I hate to quibble, but I would suggest that in the typeMap in the 
python_filter_generator.py vtkMultiBlockDataSet is listed as 
vtkMultiblockDataSet and I had to figure this out and use a small ‘b’ before it 
would work – so if you are going to publish this routine anywhere, you might 
want to edit that!

Thanks again – as soon as I figure out why it is grayed out on the Filter list 
I am going to test this thing out.

Dennis

From: Cory Quammen [mailto:[email protected]]
Sent: Thursday, September 24, 2015 3:13 PM
To: Dennis Conklin 
<[email protected]<mailto:[email protected]>>
Cc: Paraview ([email protected]<mailto:[email protected]>) 
<[email protected]<mailto:[email protected]>>
Subject: Re: [EXT] Re: [Paraview] More Customization of Python programmable 
Filter Panel

Hi Dennis,

The converter evaluates your Python script and then uses some Python reflection 
features to extract the code in your RequestData function. But it does this 
only for the RequestData function (as well as a RequestInformation and 
RequestUpdateExtent functions, but these aren't always needed). The converter 
is simply ignoring your other functions.

To get around this, try defining your sub* functions as inner functions in 
RequestData(), e.g.,

Def RequestData():
   Def sub1:
      Do some stuff
      Return var

   Def sub2(var):
      Do some stuff
      Return newVar

   Def sub3(var):
      Do some stuff
      Return newVar

   X=sub1()
   Y=sub2(X)
   Z=sub3(Y)
   Do something with Z

Best regards,
Cory

On Thu, Sep 24, 2015 at 2:39 PM, Dennis Conklin 
<[email protected]<mailto:[email protected]>> wrote:
Cory,

I’m pretending to be a real programmer, so my Programmable Filter script looks 
something like this:

Def sub1:
   Do some stuff
   Return var

Def sub2(var):
   Do some stuff
   Return newVar

Def sub3(var):
   Do some stuff
   Return newVar

Def RequestData():
       X=sub1()
       Y=sub2(X)
       Z=sub3(Y)
      Do something with Z

Everything except RequestData gets lost – should I just manually break 
everything down and insert at the beginning of the default_values in 
StringVectorProperty, or is there some way to trick it into reading the entire 
script?

Thanks

Dennis

From: Cory Quammen 
[mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, September 24, 2015 1:02 PM
To: Dennis Conklin 
<[email protected]<mailto:[email protected]>>
Cc: Paraview ([email protected]<mailto:[email protected]>) 
<[email protected]<mailto:[email protected]>>
Subject: Re: [EXT] Re: [Paraview] More Customization of Python programmable 
Filter Panel

Dennis,

Great! I'm glad it's what you are looking for.

You can hide any property by editing the XML file. In the property element, add 
an attribute called "panel_visibility" and set this to "never". This will hide 
the property from view. You can also set it to "advanced" so that it shows up 
only when the advanced option is enabled.

Here's an example:

      <StringVectorProperty
        panel_visibility="never"
        name="Script"
        command="SetScript"
        number_of_elements="1"
        default_values="my python script">
      <Documentation>This property contains the text of a python program that
      the programmable source runs.</Documentation>
      </StringVectorProperty>

Cheers,
Cory

On Thu, Sep 24, 2015 at 12:47 PM, Dennis Conklin 
<[email protected]<mailto:[email protected]>> wrote:
One more question – the original article says that

Alternatively, the Script properties can be hidden completely from the 
properties panel.

How is this accomplished?

Thanks again

Dennis

From: Dennis Conklin
Sent: Thursday, September 24, 2015 12:20 PM
To: 'Cory Quammen' <[email protected]<mailto:[email protected]>>
Cc: Paraview ([email protected]<mailto:[email protected]>) 
<[email protected]<mailto:[email protected]>>
Subject: RE: [EXT] Re: [Paraview] More Customization of Python programmable 
Filter Panel

Cory,

Wow, that’s exactly what I need – now I just need to get some time to 
re-implement my filters using this!

Thanks again

Dennis

From: Cory Quammen [mailto:[email protected]]
Sent: Thursday, September 24, 2015 11:07 AM
To: Dennis Conklin 
<[email protected]<mailto:[email protected]>>
Cc: Paraview ([email protected]<mailto:[email protected]>) 
<[email protected]<mailto:[email protected]>>
Subject: [EXT] Re: [Paraview] More Customization of Python programmable Filter 
Panel

Hi Dennis,

Answers inlined below.

On Wed, Sep 23, 2015 at 2:39 PM, Dennis Conklin 
<[email protected]<mailto:[email protected]>> wrote:
All,

Pat Marion discussed adding interactive Properties for a Programmable Filter 
here:
http://www.kitware.com/blog/home/post/534

I have a few questions about this:

1.       Is this still valid for v4.4 with the original 
python_filter_generator.py?
Yes, I just tested it.

2.      Have we added any other capability.  For instance,  I would love to 
present a list of variables to be calculated and let my user select or unselect 
each to decide exactly what he wants as output.   With a numeric field with 0 
as unselect and 1 as select, people will always manage to type something else 
in there.    If this interface could have a checklist, or if fields could have 
a drop down list (Yes/No, etc) then this would greatly expand the utility of 
this technique.
You can do this if you have a fixed number of variables. Just list each 
variable option as a IntVectorProperty with a BooleanDomain in the XML. In the 
input file for the filter generator, just express these options with the 
default values, .e.g,


Properties = dict(

  generate_var1 = True,

  generate_var2 = False,

  generate_var3 = False

  )

The filter generator will convert each of these lines into XML of the following 
form:

      <IntVectorProperty
        name="generate_var1"
        label="generate var1"
        initial_string="generate_var1"
        command="SetParameter"
        animateable="1"
        default_values="1"
        number_of_elements="1">
        <BooleanDomain name="bool" />
        <Documentation></Documentation>
      </IntVectorProperty>


These properties will appear as checkboxes in the UI of your filter.

Of course, you can tweak the XML files that are generated if it doesn't get the 
label attribute for the property right, for instance.

I hope that helps.
Cory


So, is anyone using this and perhaps knows how to do these extended things?

Thanks for any hints

Dennis

_______________________________________________
Powered by www.kitware.com<http://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



--
Cory Quammen
R&D Engineer
Kitware, Inc.



--
Cory Quammen
R&D Engineer
Kitware, Inc.



--
Cory Quammen
R&D Engineer
Kitware, 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

Reply via email to