[vtkusers] Export several vtkActor in a file which will be read in Paraview ?

David Doria daviddoria at gmail.com
Tue Nov 22 10:33:35 EST 2011


On Tue, Nov 22, 2011 at 10:27 AM, Ka Lo <kalogr at gmail.com> wrote:
> Hello,
>
> I'm trying to write some code to export a set of vtkActor build in a
> vtkRenderer to Paraview.
> I think there is something I don't understand for export in a compatible way
> to Paraview.
>
> For example, I have 300 vtkActor, each vtkActor have a vtkMapper with an
> input of vtkCubeSource type.
> And all vtkActor are in the space with size, position, orientation...
> I wish export my complete space (all vtkActor and theirs positions, size and
> orientation) in a file then open this file in Paraview for visualise all
> vtkActor in the space.
>
> I found several classes for export to output VTK files but it's only for one
> vtkActor. For example, ".vtu" file with vtkXMLUnstructuredGridWriter or
> ".vtp" file with vtkXMLPolyDataWriter...
> I have no constraint with output file, only that the file must be read by
> Paraview.
>
> Thanks a lot.
>
> Any help would be appreciated.
>
> PS: sorry for my english, if you don't understand, I will try to rewrite
> sentences.
> --
> Gregory

As far as I know, you cannot export vtkActor's at all. As you've seen,
an actor is the result of passing some data (vtkPolyData, for example)
through a mapper. You can only output the data, which can then be
viewed in Paraview. If you want to position things in the scene in VTK
and have them be in the same place in Paraview, you'll have to apply
transforms to the data itself rather than to the actors.

You can use vtkAppendPolyDataFilter to concatenate all of the data
before exporting it to a single vtp file.

David



More information about the vtkusers mailing list