[vtkusers] Using vtkXMLPolyDataWriter from Java

kent myers dakota_63124 at yahoo.com
Thu May 7 00:01:17 EDT 2015


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.


More information about the vtkusers mailing list