[Paraview] Using PythonProgrammableFilter as a reader
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Sun Oct 12 17:02:05 EDT 2014
I am not sure I follow why SetParameter won't work in your case.
Something like following is what I often end up using for such cases.
<StringVectorProperty
name="FileName"
label="FileName"
initial_string="FileName"
command="SetParameter"
animateable="1"
default_values=""
number_of_elements="1">
<Documentation></Documentation>
<FileListDomain name="files"/>
</StringVectorProperty>
On Sun, Oct 12, 2014 at 2:00 PM, Jan Brezina <jan.brezina at tul.cz> wrote:
> Hi,
>
> I'm trying to use vtkPythonProgrammableFilter to implement a reader in
> Python. The problem is in passing the filename (form the filebrowser
> dialog) to the python script (the RequestData script). I need a method
> in vtkPythonProgrammableFilter with one char * argument that can behave
> like SetFileName(char *) to set this method to command property in the
> XML file. Unfortunately, this scheme is not compatible with SetParameter
> methods of vtkPythonProgrammableFilter. Finally, I find a hack using the
> method SetProgressText (from vtkAlgorithm) instead of SetFileName. So my
> XML looks like:
>
> <ServerManagerConfiguration>
> <ProxyGroup name="sources">
> <SourceProxy name="EGrid Reader"
> class="vtkPythonProgrammableFilter"
> label="EGrid Reader">
> <StringVectorProperty
> name="FileName"
> animateable="0"
> command="SetProgressText"
> number_of_elements="1"
> panel_visibility="advanced">
> <FileListDomain name="files"/>
> </StringVectorProperty>
> <IntVectorProperty command="SetOutputDataSetType"
> default_values="4"
> name="OutputDataSetType"
> number_of_elements="1"
> panel_visibility="never">
> </IntVectorProperty>
> <StringVectorProperty
> name="Script"
> command="SetScript"
> number_of_elements="1"
> default_values="print self.GetProgressText()"
> panel_visibility="advanced">
> <Hints>
> <Widget type="multi_line"/>
> </Hints>
> </StringVectorProperty>
> <Hints>
> <ReaderFactory extensions="egrid"
> file_description="Eclipse mesh File Format" />
> </Hints>
> </SourceProxy>
> </ProxyGroup>
> </ServerManagerConfiguration>
>
> Is there a beter way how to pass the filename to the script? If not,
> could a SetFileName method be implemented in vtkPythonProgrammableFilter
> that simply calls
>
> SetParameter("FileName", the_path)
>
> ?
>
> Thank you for a help,
> Jan
>
> --
> ------------------------
> Mgr. Jan Brezina, Ph. D.
> Technical University in Liberec, New technologies institute
> http://www.nti.tul.cz/cz/WikiUser:Jan.Brezina
>
> --
> ------------------------
> Mgr. Jan Brezina, Ph. D.
> Technical University in Liberec, New technologies institute
> http://www.nti.tul.cz/cz/WikiUser:Jan.Brezina
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
More information about the ParaView
mailing list