[Paraview] (no subject)

Sebastien Jourdain sebastien.jourdain at kitware.com
Sat Dec 1 14:49:19 EST 2012


You can use the completion in the Python shell of ParaView.
Otherwise, you will have to look into the XML file in the source code
repository at the following
path: src/ParaViewCore/ServerManager/SMApplication/Resources/*.xml
to get the list of properties available for each object/proxy that you can
build.

To figured out writer.FileType, I've used

print str(writer.ListProperties())

Seb


On Sat, Dec 1, 2012 at 12:51 PM, Timothy Cale <drtsc.para at gmail.com> wrote:

> Sebastien:
>
> As a follow up:
>
> Using    writer.FileType = 'Ascii'     did work to complete the script
> generated by Trace. (first_stab.py)
>
> On the other hand, the script you sent did not work, as sent.
>
> By comparing the two scripts, and removing/adding back lines of code, the
> only line I needed to
> add to your (stand-alone, rather than Trace-generated) script is:
>
> DataRepresentation3 = Show()
>
> after smoothing.  With that line, the slightly modified version of the
> script you sent is:
>
> from paraview.simple import *
> nanocone_pvd_1_vtp = XMLPolyDataReader(
> FileName=['/home/tscale/pv_sims/results/nanocone_pvd_1.vtp'] )
> Smooth1 = Smooth()
> Smooth1.NumberofIterations = 200
> DataRepresentation3 = Show()
> writer = CreateWriter("foo2.ply",Smooth1)
> writer.FileType='Ascii'
> writer.UpdatePipeline()
> del writer
>
> (Note that I changed the name of the imported data in your script, and
> added del writer at the end.)
>
> I have no clue as to what this line does, but if it is not there, the
> following message (among a lot of
> other output) appears:
> vtkSMWriterFactory (0xc89c10): No matching writer found for extension: ply
>
> Thanks again,
> Tim
>
>
> On Sat, Dec 1, 2012 at 8:42 AM, Sebastien Jourdain <
> sebastien.jourdain at kitware.com> wrote:
>
>> Here is the script that you should run
>>
>> from paraview.simple import *
>>
>> data = XMLPolyDataReader( FileName=['/.../file.vtp'] )
>>
>> smooth = Smooth(data)
>> smooth.NumberofIterations = 200
>>
>> writer = CreateWriter("foo.ply", smooth)
>> writer.FileType = 'Ascii'
>> writer.UpdatePipeline()
>>
>>
>>
>> On Fri, Nov 30, 2012 at 3:10 PM, Timothy Cale <drtsc.para at gmail.com>wrote:
>>
>>> Sebastien:
>>>
>>> The data file I attached to the previous version of this update note was
>>> too large.
>>>
>>> I am resending the note with that file removed.
>>>
>>> Tim
>>>
>>> ---------- Forwarded message ----------
>>> From: Timothy Cale <drtsc.para at gmail.com>
>>> Date: Fri, Nov 30, 2012 at 1:03 PM
>>> Subject: Re: [Paraview] (no subject)
>>> To: Sebastien Jourdain <sebastien.jourdain at kitware.com>
>>> Cc: "paraview at paraview.org" <paraview at paraview.org>
>>>
>>>
>>> Update:
>>>
>>> I am able to write a ply file using CreateWriter (see attached
>>> first_stab.py and nano....vtp files).
>>> But the ply file is in binary.
>>>
>>> I looked around for more than an hour to find out how to write the file
>>> in ascii - to no avail.
>>>
>>> Any hints?
>>>
>>> Aside: When I put in 0 (for ascii) as a third arg. to CreateWriter,
>>> pvpython complained about
>>> having more than 2 arguments. I note that in the paraview users guide,
>>> CreateWriter has
>>> several arguments in some cases. help(CreateWriter) indicates that more
>>> than 2 arguments
>>> can be used:
>>>
>>> >>> help(CreateWriter)
>>>
>>> Help on function CreateWriter in module paraview.simple:
>>>
>>>
>>> CreateWriter(filename, proxy=None, **extraArgs)
>>>
>>> Creates a writer that can write the data produced by the source proxy in
>>>
>>> the given file format (identified by the extension). If no source is
>>>
>>> provided, then the active source is used. This doesn't actually write the
>>>
>>> data, it simply creates the writer and returns it.
>>>
>>> Regards,
>>> Tim
>>>
>>> On Fri, Nov 30, 2012 at 10:15 AM, Timothy Cale <drtsc.para at gmail.com>wrote:
>>>
>>>> Sebastien:
>>>>
>>>> Good question:
>>>>
>>>> My goal is to have a script which smooths results between simulation
>>>> steps (fortran codes).
>>>>
>>>> I use paraview to view results, and the smoothing filter in paraview
>>>> seems to do what I want.
>>>>
>>>> I want to start with a Trace-generated python script, and edit it to
>>>> write the vertices and element
>>>> info to a file (.ply would be nice) that the next code can read.
>>>>
>>>> So, fortunately for me (in some sense), I decided to upgrade my ubuntu
>>>> OS to 12.10. This has
>>>> paraview 3.14.1-6build1 on its software list (aptitude).
>>>>
>>>> This version corrected a bug (with pvpython) in the version of paraview
>>>> 3.14 that I was using.
>>>> (I also spent a day trying to get/install other versions. That was not
>>>> very successful.)
>>>>
>>>> Now if I import the trace generated py file, it pops up (and stays).
>>>> Not a very good image, but it is
>>>> a start!
>>>>
>>>> Being new to python and paraview, this is quite a step.
>>>>
>>>> Any suggestions as to how to write vertex/node info would be
>>>> appreciated.
>>>>
>>>>
>>>> Thanks,
>>>> Tim
>>>>
>>>> On Thu, Nov 29, 2012 at 7:41 PM, Sebastien Jourdain <
>>>> sebastien.jourdain at kitware.com> wrote:
>>>>
>>>>> I don't know ? what your script is supposed to do ? Render an image
>>>>> and quit ?
>>>>>
>>>>>
>>>>> On Thu, Nov 29, 2012 at 1:19 PM, Timothy Cale <drtsc.para at gmail.com>wrote:
>>>>>
>>>>>> I am using paraview 3.14 (64 bit, ubuntu 12.04 vm on a MBP).
>>>>>>
>>>>>> I am trying to run pvpython to view .py files generated using Trace:
>>>>>>
>>>>>> 'which' pvpython' yields: /usr/bin/pvpython
>>>>>>
>>>>>> 'pvpython' yields: Error converting executable file
>>>>>> "/usr/bin/../lib/paraview/pvpython" to real path: No such file or directory
>>>>>>
>>>>>> So, /usr/bin/python seems to be looking for /usr/lib/paraview/pvpython
>>>>>>
>>>>>> Which is indeed not there.
>>>>>>
>>>>>> I uninstalled (purged) and installed 3.14 again. Same thing.
>>>>>>
>>>>>> BTW: I did see the notes regarding 3.14.1-2 from ~6 months ago, but
>>>>>> cannot tell which 3.14 binary installer is on the
>>>>>> Paraview download page.
>>>>>>
>>>>>> Nevertheless, I downloaded the 3.14 tar-ball.
>>>>>>
>>>>>> When I run a .py script generated using trace, an image pops up for a
>>>>>> second, then disappears.
>>>>>>
>>>>>> BTW: The same thing happens with 3.98, at least on a companion
>>>>>> machine.
>>>>>>
>>>>>> What am I missing?
>>>>>>
>>>>>> Thanks,
>>>>>> Tim
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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://www.paraview.org/mailman/listinfo/paraview
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20121201/daece27b/attachment.htm>


More information about the ParaView mailing list