<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="MSHTML 11.00.9600.18098">
<style id="owaParaStyle">P {
MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px
}
</style>
</head>
<body fPStyle="1" ocsi="0">
<p>Hello,<br>
<br>
No, due to project time constraint, i had to implement my method to generate the PLY file.<br>
By the way, the stlWriter works very well. It uses the same vtkPolyData that my plyWriter.<br>
<br>
<font face="Courier New">stlWriter->SetFileName(filename.c_str());<br>
stlWriter->SetInputData(polydata);<br>
stlWriter->SetFileTypeToBinary();<br>
stlWriter->Write();<br>
</font></p>
<p>I have a small example that figure out that problem but it is based on Qt widgets and qmake. Are you interested in ?<br>
Otherwise, maybe you could enhance the examples for C++ that shows how a plyWriter can be used with a vtkPolyData ?<br>
<br>
Best regards,<br>
David.<br>
<br>
<br>
________________________________________<br>
De : Cory Quammen [cory.quammen@kitware.com]<br>
Envoyé : lundi 11 janvier 2016 15:17<br>
À : MOUSSAUD David 244079<br>
Cc : vtkusers@vtk.org<br>
Objet : Re: [vtkusers] vtkPLYWriter : vertices are not generated in a the PLY file<br>
<br>
David,<br>
<br>
Have you made any progress on this issue?<br>
<br>
I can generate a Point Source in ParaView and save it to a PLY file.<br>
It saved the point locations just fine. By the way, ParaView uses the<br>
vtkPLYWriter to write points.<br>
<br>
I don't see anything odd in the reader that would cause me to think<br>
your points wouldn't get written.<br>
<br>
If you are still having trouble, could you post a self-contained .cxx<br>
file and CMakeLists.txt file? That will make it easier for us to<br>
diagnose what is going on.<br>
<br>
Thanks,<br>
Cory<br>
<br>
On Thu, Jan 7, 2016 at 11:44 AM, MOUSSAUD David 244079<br>
<David.MOUSSAUD@cea.fr> wrote:<br>
> Yes it works, I have already success to generate one (without using vtk library).<br>
> After the line "end_header', you have to write line by line the 3 coordinates of the vertices and theirs RGB colors (3 more numbers)<br>
> You don't need to generate the faces if it is set to the 0 value in the header.<br>
> Best Regards,<br>
><br>
> David MOUSSAUD<br>
><br>
> ________________________________________<br>
> De : Cory Quammen [cory.quammen@kitware.com]<br>
> Envoyé : jeudi 7 janvier 2016 16:58<br>
> À : MOUSSAUD David 244079<br>
> Cc : vtkusers@vtk.org<br>
> Objet : Re: [vtkusers] vtkPLYWriter : vertices are not generated in a the PLY file<br>
><br>
> Hi David,<br>
><br>
> Can you confirm that the PLY file format supports single-vertex cells<br>
> like this? My perusal of the PLY documentation didn't reveal anything.<br>
><br>
> Thanks,<br>
> Cory<br>
><br>
> On Thu, Jan 7, 2016 at 9:55 AM, MOUSSAUD David 244079<br>
> <David.MOUSSAUD@cea.fr> wrote:<br>
>> Hi all,<br>
>><br>
>><br>
>><br>
>> I've got a problem to generate a simple ply file with 4 vertices.<br>
>><br>
>> Here how i proceed :<br>
>><br>
>><br>
>><br>
>> // Setup points<br>
>><br>
>> points = vtkSmartPointer<vtkPoints>::New();<br>
>><br>
>><br>
>> // Setup the colors array<br>
>><br>
>> colors = vtkSmartPointer<vtkUnsignedCharArray>::New();<br>
>><br>
>> colors->SetNumberOfComponents(3);<br>
>><br>
>> colors->SetName("Colors");<br>
>><br>
>><br>
>> // create a vertex<br>
>><br>
>> vertex = vtkSmartPointer<vtkVertex>::New();<br>
>><br>
>><br>
>> // list of all the vertices<br>
>><br>
>> vertices= vtkSmartPointer<vtkCellArray>::New();<br>
>><br>
>><br>
>> /* Create a PLY Writer */<br>
>><br>
>> plyWriter = vtkSmartPointer<vtkPLYWriter>::New();<br>
>><br>
>><br>
>> // Create a polydata object and add everything to it<br>
>><br>
>> polydata = vtkSmartPointer<vtkPolyData>::New();<br>
>><br>
>> polydata->SetPoints(points);<br>
>><br>
>> polydata->SetVerts(vertices);<br>
>><br>
>> polydata->GetPointData()->SetScalars(colors);<br>
>><br>
>><br>
>><br>
>> Then here how i create my vertices and how i set them :<br>
>><br>
>><br>
>><br>
>> points->Resize(4);<br>
>><br>
>> points->SetPoint(0, 0.0, 0.0, 0.0);<br>
>><br>
>> points->SetPoint(1, 1.0, 0.0, 0.0);<br>
>><br>
>> points->SetPoint(2, 0.0, 1.0, 0.0);<br>
>><br>
>> points->SetPoint(3, 0.0, 0.0, 1.0);<br>
>><br>
>><br>
>> vertices->Initialize();<br>
>><br>
>><br>
>> vertex->GetPointIds()->SetId(0,0);<br>
>><br>
>> vertices->InsertNextCell(vertex);<br>
>><br>
>><br>
>> vertex->GetPointIds()->SetId(0,1);<br>
>><br>
>> vertices->InsertNextCell(vertex);<br>
>><br>
>><br>
>> vertex->GetPointIds()->SetId(0,2);<br>
>><br>
>> vertices->InsertNextCell(vertex);<br>
>><br>
>><br>
>> vertex->GetPointIds()->SetId(0,3);<br>
>><br>
>> vertices->InsertNextCell(vertex);<br>
>><br>
>><br>
>> colors->Initialize();<br>
>><br>
>> colors->InsertNextTuple3(255,0,0);<br>
>><br>
>> colors->InsertNextTuple3(0,255,0);<br>
>><br>
>> colors->InsertNextTuple3(0,0,255);<br>
>><br>
>> colors->InsertNextTuple3(255,255,255);<br>
>><br>
>><br>
>><br>
>> QString plyFilePath = "output.ply";<br>
>><br>
>><br>
>> std::string filename = plyFilePath.toStdString();<br>
>><br>
>> plyWriter->SetFileName(filename.c_str());<br>
>><br>
>><br>
>> plyWriter->SetInputData(polydata);<br>
>><br>
>><br>
>><br>
>> plyWriter->SetColorModeToUniformPointColor();<br>
>><br>
>> plyWriter->SetArrayName("Colors");<br>
>><br>
>> plyWriter->SetFileTypeToASCII();<br>
>><br>
>> plyWriter->Write();<br>
>><br>
>><br>
>><br>
>> I've checked that the 4 vertex are well displayed (cf screenshot).<br>
>><br>
>><br>
>><br>
>> Unfortunately, my ply file shows 0 vertex.<br>
>><br>
>><br>
>><br>
>> ply<br>
>> format ascii 1.0<br>
>> comment VTK generated PLY File<br>
>> obj_info vtkPolyData points and polygons: vtk4.0<br>
>> element vertex 0<br>
>> property float x<br>
>> property float y<br>
>> property float z<br>
>> property uchar red<br>
>> property uchar green<br>
>> property uchar blue<br>
>> element face 0<br>
>> property list uchar int vertex_indices<br>
>> end_header<br>
>><br>
>><br>
>><br>
>> I'm using vtk 6.3.<br>
>><br>
>><br>
>><br>
>> If someone has already meet this problem or know the solution ...<br>
>><br>
>><br>
>><br>
>> Thanks for your time,<br>
>><br>
>> Best regards,<br>
>><br>
>><br>
>><br>
>> David MOUSSAUD.<br>
>><br>
>><br>
>> _______________________________________________<br>
>> Powered by www.kitware.com<br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> http://www.kitware.com/opensource/opensource.html<br>
>><br>
>> Please keep messages on-topic and check the VTK FAQ at:<br>
>> http://www.vtk.org/Wiki/VTK_FAQ<br>
>><br>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers<br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> http://public.kitware.com/mailman/listinfo/vtkusers<br>
>><br>
><br>
><br>
><br>
> --<br>
> Cory Quammen<br>
> R&D Engineer<br>
> Kitware, Inc.<br>
<br>
<br>
<br>
--<br>
Cory Quammen<br>
R&D Engineer<br>
Kitware, Inc.</p>
</body>
</html>