[vtkusers] how to export a ply file with color infomation

David Doria daviddoria at gmail.com
Wed Aug 10 08:09:29 EDT 2011


Please keep the discussion on the mailing list.

> //Import the vtk file
> vtkSmartPointer<vtkPolyDataReader>
> reader=vtkSmartPointer<vtkPolyDataReader>::New();
> reader->SetFileName("mesh.vtk");
> vtkPolyData* vtkdata = reader->GetOutput();
> //vtkdata->GetNumberOfPoints();
>
>          //the function vtkdata->GetNumberofPoints() returns 0 instead of
> the proper number 36 here

You need to call reader->Update() before the GetNumberOfPoints() call.

> use the writer to export .ply file,but color info is missing in the result.

Sorry, I have not used PLY enough to know what could be wrong wrong.
However, I have verified that what we are doing here does not seem to
produce colors in the output file.

David



More information about the vtkusers mailing list