[Paraview] [ParaView] Problem with saving data from python

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Apr 18 16:07:27 EDT 2018


Ah, the box! The box API needs to cleaned up, I am afriad. Until then,
the following is the way to go.

from paraview.simple import *

w = Wavelet()
UpdatePipeline()
bds = w.GetDataInformation().GetBounds()
c = Clip()
c.ClipType="Box"
c.ClipType.Bounds = bds  #<----- NOTE THIS
c.ClipType.Scale = [0.5, 0.5, 1.0]
SaveData("/tmp/foo.vtu")

Utkarsh


On Wed, Apr 18, 2018 at 3:06 PM, Gena Bug via ParaView
<paraview at public.kitware.com> wrote:
> Nope, it doesn't help. Seems to me it somehow connected to the fact that
> type of the clip is 'Box'. It it, for example, 'Plane', than saving works.
>
>
>
> On 18.04.2018 20:46, Utkarsh Ayachit wrote:
>>
>> Try inserting a `UpdatePipeline()` after creating the Wavelet but
>> before the clip. Without that, the clip gets initialized with
>> incorrect bounds and the box scale factor doesn't get applied
>> correctly.
>>
>> Utkarsh
>>
>> On Wed, Apr 18, 2018 at 12:06 PM, Gena Bug via ParaView
>> <paraview at public.kitware.com> wrote:
>>>
>>> Hi!
>>>
>>> I've spent couple of hours but couldn't understand what I do wrong. When
>>> running following script from console ($ pvpython script.py):
>>>
>>> from paraview.simple import *
>>> paraview.simple._DisableFirstRenderCameraReset()
>>>
>>> wavelet1 = Wavelet()
>>>
>>> clip1 = Clip(Input=wavelet1)
>>> clip1.ClipType = 'Box'
>>> clip1.ClipType.Scale = [0.5, 0.5, 1.0]
>>>
>>> SaveData('fuu.vtu', proxy=clip1, CompressorType='ZLib')
>>>
>>> UpdatePipeline()
>>>
>>> I see the file fuu.vtu but it doesn't contain any data nor mesh. However
>>> if
>>> I do these steps from the GUI then I get correct file.
>>>
>>> PV 5.5 for linux64, downloaded from the site. Run on debian testing.
>>> _______________________________________________
>>> 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:
>>> https://public.kitware.com/mailman/listinfo/paraview
>>
>>
> _______________________________________________
> 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:
> https://public.kitware.com/mailman/listinfo/paraview


More information about the ParaView mailing list