[vtkusers] Using vtkXMLPolyDataWriter from Java

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu May 7 10:13:34 EDT 2015


The only 2 things that I find strange are:

writer.SetInputConnection(elementFaceActor.GetMapper().GetOutputPort()); //
(option 1)
writer.SetInputData(elementFaceActor.GetMapper().GetInputAsDataSet()); //
(option 2)

Which option are you using? What type of dataset are you using initially?
Did you try vtkDataSetWriter/Reader, to see if you had similar behavior?

Seb

On Wed, May 6, 2015 at 10:01 PM, kent myers via vtkusers <vtkusers at vtk.org>
wrote:

> I am trying to export to XML using the vtkXMLPolyDataWriter from Java using
> the following code:
>
>         public void exportGraphicFile(String filename) {
>             //Write the file
>             vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter();
>             writer.SetFileName(filename);
>
> writer.SetInputConnection(elementFaceActor.GetMapper().GetOutputPort());
> //
> writer.SetInputData(elementFaceActor.GetMapper().GetInputAsDataSet());
>
>             //Optional - set the mode. The default is binary.
>             //writer.SetDataModeToBinary();
>             writer.SetDataModeToAscii();
>             writer.Update();
>             writer.Write();
>         }
>
> I get a file that has some XML tags (see attached file), but it does not
> appear to be complete, and I do not get anything back when I attempt to
> import it using vtkXMLPolyDataReader as shown below:
>
>         public void importGraphicFile(String filename) {
>             //read all the data from the file
>             vtkXMLPolyDataReader reader = new vtkXMLPolyDataReader();
>             reader.SetFileName(filename);
>             reader.Update();
>
>             //Create a mapper and actor
>             vtkPolyDataMapper mapper = new vtkPolyDataMapper();
>             mapper.SetInputConnection(reader.GetOutputPort());
>
>             elementFaceActor.SetMapper(mapper);
>              SimfinitTestHex2.vtk
> <http://vtk.1045678.n5.nabble.com/file/n5731801/SimfinitTestHex2.vtk>
>             updateView();
>
>         }
>
> Does anyone know what I am doing wrong?
>
> Thanks!
>
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Using-vtkXMLPolyDataWriter-from-Java-tp5731801.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150507/5799963f/attachment.html>


More information about the vtkusers mailing list