[vtkusers] Saving a vtp file from vtkPolyData

David Doria daviddoria at gmail.com
Sat May 10 07:09:35 EDT 2014


On Fri, May 9, 2014 at 4:55 PM, Sam Raby <rabysam28 at gmail.com> wrote:

> In the following VTK example:
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ContoursToSurface
>
> after the surface of sphere is generated, I am trying to simply save the
> surface as a vtp file using the following code, but I can not, that is, the
> saved file does not show anything. Can anyone help why this happens?
> Thanks.
>
>
>     vtkPolyData *myvtkPolyData = vtkPolyData::SafeDownCast(
> surfaceMapper->GetInputAsDataSet() );
>     vtkSmartPointer<vtkXMLPolyDataWriter> writer =
> vtkSmartPointer<vtkXMLPolyDataWriter>::New();
>     writer->SetFileName("/home/surface.vtp");
>     writer->SetInputData( myvtkPolyData );
>     writer->SetDataModeToBinary();
>     writer->Write();
>

What do you mean it does not show anything? How are you trying to view it?
I would suggest using Paraview.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140510/dd44f223/attachment.html>


More information about the vtkusers mailing list