<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffff99" text="#000000">
Ok in fact the good attribute name is : ScriptRequestInformation <br>
<br>
Le 08/06/2010 14:18, Jérôme Plumecoq a écrit :
<blockquote cite="mid:4C0E3511.3000403@c-s.fr" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Hello,<br>
<br>
Thank you Eric : now I can read my datas with a ProgrammableSource, and
display them.<br>
<br>
But I would like to create a ProgrammableSource in a python script, and
I have this error when I try to set the InformationScript (which is
necessary to display the datas) attribute :<br>
<br>
<tt>Traceback (most recent call last):<br>
File "<string>", line 1, in <module><br>
File "/home/plumecoq/EHPOC/plugins/ElsaMenu/elsa.py", line 106, in
<module><br>
main()<br>
File "/home/plumecoq/EHPOC/plugins/ElsaMenu/elsa.py", line 85, in main<br>
ps.InformationScript = str_information_script<br>
File
"/home/plumecoq/Paraview/ParaView-3.8.0-bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
line
201, in __setattr__<br>
"to add this attribute.")<br>
AttributeError: Attribute InformationScript does not exist. This class
does not allow addition of new attributes to avoid mistakes due to
typos. Use add_attribute() if you really want to add this attribute.<br>
<br>
</tt><br>
My code is :<br>
<br>
<tt># solution 2 : Programmable Source<br>
ps = ProgrammableSource()<br>
ps.OutputDataSetType = 2 # 2 : Structured Grid, 13 :
MultiblockDataSet<br>
str_script = """<br>
import lecture_v3d as v3d<br>
reader =
v3d.V3dReader("/home/plumecoq/tmp/ParaView/flow_1_0075.v3d")<br>
self.GetOutput().DeepCopy(reader.bloc_vts)<br>
"""<br>
ps.Script = str_script<br>
<br>
str_information_script = """<br>
from paraview import util<br>
util.SetOutputWholeExtent(self, [0, 10, 0, 10, 0, 30])<br>
"""<br>
ps.InformationScript = str_information_script</tt><br>
<br>
<br>
when I put the string str_information_script in the window
Script(RequestInformation) of the ProgrammableSource, it works fine.<br>
<br>
any ideas ?<br>
<br>
Jérôme<br>
<br>
Le 07/06/2010 13:30, Eric E. Monson a écrit :
<blockquote
cite="mid:673738E2-D689-470D-B483-43247F32CAB3@cs.duke.edu" type="cite">Hey
Jérôme,
<div><br>
</div>
<div>Yes, you can use the Python Programmable Source as a reader.
There are some examples on these two pages, in case you haven't seen
them:</div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="http://www.paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters">http://www.paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters</a></div>
<div><a moz-do-not-send="true"
href="http://www.paraview.org/Wiki/Python_Programmable_Filter">http://www.paraview.org/Wiki/Python_Programmable_Filter</a></div>
<div><br>
</div>
<div>-Eric</div>
<div><br>
</div>
<div>
<div><span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">------------------------------------------------------<br>
Eric E Monson<br>
Duke Visualization Technology Group<br>
</span></div>
<div><br>
</div>
<br>
<div>
<div>On Jun 7, 2010, at 4:58 AM, Jérôme Plumecoq wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div bgcolor="#ffff99" text="#000000">Hello,<br>
<br>
thank you very much !<br>
<br>
Do you know if is possible to write directly a reader in python ? <br>
<br>
Or is it only possible in C++ ?<br>
<br>
Jérôme<br>
<br>
Le 04/06/2010 15:37, Utkarsh Ayachit a écrit :
<blockquote
cite="mid:AANLkTin9V85ReDHN-briUo-25DVGrQDAREwo7wcB7oDA@mail.gmail.com"
type="cite">
<pre wrap="">There was a bug in OpenDataFile() that was fixed a few days ago (May
26) that is causing that "AttributeError: Attribute FileName does not
exist". Attached is a patch for the same.
Utkarsh
2010/6/4 Berk Geveci <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E" href="mailto:berk.geveci@kitware.com"><berk.geveci@kitware.com></a>:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">1) reading :
------------
from a vtkStructuredGrid object, I use a vtkStructuredGridWriter to create a
vtk file, and I have the following problem :
when I launch the script in Paraview, the format of floating points is not
good (I obtain for example 33,1632 instead of 33.1632). So, the file created
is not readable by Paraview. If I launch the script directly in a terminal,
it works fine. Perhaps because the version of vtk module is not the same ?
If I use the binary format I have not this problem.
</pre>
</blockquote>
<pre wrap="">This seems to be related to the way the LOCALE is set on your system. It is
probably set to French in one case and English in the other. Does anybody know
if we can force LOCALE to English in the ParaView application or the reader?
</pre>
<blockquote type="cite">
<pre wrap="">2) writing :
------------
I would like to read my vtk files from the python shell, with
OpenDataFile(), but It didn't succeed and I have the following message (with
a file which can be read in paraview using menu open of course :-) :
</pre>
</blockquote>
<pre wrap="">Unless I am mistaken, you give the filename directly to OpenDataFile(),
without FileName=.
-berk
</pre>
<blockquote type="cite">
<pre wrap="">/home/plumecoq/tmp/ParaView/flow_1_0075.vtk
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/plumecoq/EHPOC/plugins/ElsaMenu/elsa.py", line 91, in <module>
main()
File "/home/plumecoq/EHPOC/plugins/ElsaMenu/elsa.py", line 73, in main
reader_vtk = OpenDataFile(file_name_vtk)
File
"/home/plumecoq/Paraview/ParaView-3.8.0-bin/Utilities/VTKPythonWrapping/paraview/simple.py",
line 115, in OpenDataFile
reader = globals()[xml_name](FileName=filename, **extraArgs)
File
"/home/plumecoq/Paraview/ParaView-3.8.0-bin/Utilities/VTKPythonWrapping/paraview/simple.py",
line 542, in CreateObject
setattr(px, param, params[param])
File
"/home/plumecoq/Paraview/ParaView-3.8.0-bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
line 201, in __setattr__
"to add this attribute.")
AttributeError: Attribute FileName does not exist. This class does not
allow addition of new attributes to avoid mistakes due to typos. Use
add_attribute() if you really want to add this attribute.
any ideas ? I try to use LegacyVTKFileReader instead, but I have also some
problems.
I use a re-compile version of Paraview 3.8, under Linux (Fedora 10 - 64
bits)
thanks for your help.
Jérôme
_______________________________________________
Powered by <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="http://www.kitware.com/">www.kitware.com</a>
Visit other Kitware open-source projects at
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the ParaView Wiki at:
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a>
Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a>
</pre>
</blockquote>
<pre wrap="">_______________________________________________
Powered by <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="http://www.kitware.com/">www.kitware.com</a>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the ParaView Wiki at: <a
moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a>
Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a>
</pre>
</blockquote>
</blockquote>
<br>
</div>
<span><jerome_plumecoq.vcf></span>_______________________________________________<br>
Powered by <a moz-do-not-send="true" href="http://www.kitware.com">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a
moz-do-not-send="true" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the ParaView Wiki at: <a class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a>
</pre>
</blockquote>
<br>
</body>
</html>