[Paraview] Saving a slice of data for later visualization

Andy Bauer andy.bauer at kitware.com
Tue Oct 27 07:55:20 EDT 2015


Hi Tim,

I believe that the writer you want is the XML multiblock data writer --
XMLMultiBlockDataWriter(). The extension for that is .vtm. The reason for
this is that a slice through a multiblock data set outputs a multiblock of
polydata. You can use the Merge Blocks filter to reduce it to an
unstructured grid.

Cheers,
Andy

On Mon, Oct 26, 2015 at 8:21 PM, Tim Gallagher <tim.gallagher at gatech.edu>
wrote:

> Hi,
>
> I'm struggling to write a script for Paraview that will let me take a
> slice through my vtkMultiblockDataSet and save just the slice (so all of
> the data on the slice and all of the points that make up the slice) in a
> format that I can look at later. I can get it to dump all of the data to a
> set of CSV files, but I can't look at those again in paraview.
>
> My function is very simple (see below). I have tried to use CreateWriter
> directly with the .vtk file extension like is shown on
> http://www.paraview.org/Wiki/ParaView/Python_Scripting#Writing_Data_Files_.28ParaView_3.9_or_later.29
> but that says the vtk file format is unknown and so it doesn't work.
>
> I have tried virtually every writer that would make sense in that writer
> line and none of them work properly. As it is, the one that is there now
> says:
>
> vtkCompositeDataPipeline (0x9ac9380): Can not execute simple alorithm
> without output ports
>
> and I don't know what that means or why it fails to write. (Side note --
> algorithm is spelled wrong in that error message, comes from
> vtkCompositeDataPipeline.cxx line 168).
>
> Anybody have any suggestions or advice on how to save the datasets that
> results from a slice so I can look at just that slice later?
>
> Thanks,
>
> Tim
>
> def run(out_dir, file_num, spreadsheet_name, slice_origin, slice_normal,
> triangulate=False):
>     restart_file = XDMFReader(FileName=out_dir+'/RESTS/rest_%05i.xmf' %
> file_num)
>     restart_file_dr = Show()
>
>     if triangulate:
>         tri = 1
>     else:
>         tri = 0
>
>     my_slice = Slice(SliceOffsetValues=[0.0], Triangulatetheslice=tri,
> SliceType="Plane" )
>     my_slice.SliceType.Origin = slice_origin
>     my_slice.SliceType.Normal = slice_normal
>
>     slice_dr = Show()
>
>     writer = XMLUnstructuredGridWriter(Input=my_slice)
>     writer.FileName = out_dir+"/post/"+"%s_data_%05i_.vtu" %
> (spreadsheet_name, file_num)
>     writer.UpdatePipeline()
> _______________________________________________
> 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:
> http://public.kitware.com/mailman/listinfo/paraview
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20151027/9ba6c92c/attachment.html>


More information about the ParaView mailing list