[Paraview] question on using python programmable source

Jed Frechette jedfrechette at gmail.com
Fri May 30 15:59:58 EDT 2008


On 29 May 2008 19:29:55 +0200 reejith Kuttanikkad wrote:
> Dear,
> I have number of  files with each file contains  many points (x,y,z
> coordinates) of a line/curve. I use python programmable source to  
> visualize
> those lines  (like the example given to generates a Helix curve in the
> paraview Wiki.)
> I use file=fopen("file1",'r') and extract the coordinates of each  
> point from
> the file  and visualize that line.. and it is working great.
> now the problem is,  i have so many files (many lines) and i want to  
> see all
> the lines at once.
> so i could use like
>
> FILES=["file1.dat","file2.dat", ..... ]
> for filename in FILES:
>   file=open(filename,'r')

I have been following this discussion and am trying to solve a related  
problem. I only have one file to deal with but would like the user to  
be able to specify the filename from a nice interface, similar to the  
Helix example. Ideally I would pop up a file browser but for now  
simply typing the path is sufficient. I have this working with an xml  
file that includes an element like:

<StringVectorProperty
   name="FileName"
   command="SetParameter"
   number_of_elements="2"
   default_values_delimiter=";"
   default_values="filename;r'/tmp/test.xyz'">
</StringVectorProperty>

Unfortunately, I need to include the quotes when entering a path in  
the ui, otherwise Python will throw an exception when it tries to do:

filename = /tmp/test.xyz

Is there a way to modify the ui so that it automatically returns a raw  
string containing whatever is entered in a text box?

Best,

--
Jed Frechette

University of New Mexico Lidar Lab
www.unm.edu/~lidar



More information about the ParaView mailing list