<div dir="ltr"><div>You would not have to build VTK if you could use existing script and would not need do something special,<br>If you are going to use C++ you will end up with building VTK yourself.<br></div><div>You will need to download and install CMAKE, which according to options you would provide will generate projects for your compiler .<br>
</div><div>Then you will build that huge project with your compiler.<br></div><div>Then you have a choice either to include headers and link against needed dlls manually in your project or create your project with CMake which would simplify the process, especially for latest VTK version.<br>
<br>Iterating over cells will be your least problem if you did not install VTK yet.<br>Once you have vtkUnstructuredGrid loaded with data it is pretty easy. <br><a class="" href="http://www.vtk.org/doc/nightly/html/vtkType_8h.html#a20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> vtkUnstructuredGrid::<a class="" href="http://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#aa3f89fb37b91e068b3ad971a8d6769d0">GetNumberOfCells</a> ()<br>
</div><div>will give you number of cells.<br><br><table class=""><tbody><tr><td class=""><a class="" href="http://www.vtk.org/doc/nightly/html/vtkVectorOperators_8h.html#a61569f2965b7a369eb10b6d75d410d11">int</a> vtkUnstructuredGrid::GetCellType </td>
<td>(</td>
<td class=""><a class="" href="http://www.vtk.org/doc/nightly/html/vtkType_8h.html#a20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> </td>
<td class=""><em>cellId</em></td><td>)</td>
<td><br></td></tr></tbody></table>will tell you what type specific cell is.<br><table class=""><tbody><tr><td class=""></td>
<td><br></td>
<td class=""><br></td>
<td class=""><br></td><td><br></td>
<td><br></td></tr></tbody></table></div><div><table class=""><tbody><tr><td class="">vtkUnstructuredGrid::GetCellPoints </td>
<td>(</td>
<td class=""><a class="" href="http://www.vtk.org/doc/nightly/html/vtkType_8h.html#a20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> </td>
<td class=""><em>cellId</em>, </td>
</tr>
<tr>
<td class=""><br></td>
<td><br></td>
<td class=""><a class="" href="http://www.vtk.org/doc/nightly/html/classvtkIdList.html">vtkIdList</a> * </td>
<td class=""><em>ptIds</em> </td>
</tr>
<tr>
<td><br></td>
<td>)</td>
<td><br></td></tr></tbody></table></div><div>will give you points for specific cells, then you could use these points to create triangle.<br><br></div><div>Or you can get everything from <a class="" href="http://www.vtk.org/doc/nightly/html/classvtkCell.html">vtkCell</a> pointer you can get with<br>
</div><div><table class=""><tbody><tr><td class=""> <a class="" href="http://www.vtk.org/doc/nightly/html/classvtkCell.html">vtkCell</a>* vtkUnstructuredGrid::GetCell </td><td>(</td><td class=""><a class="" href="http://www.vtk.org/doc/nightly/html/vtkType_8h.html#a20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> </td>
<td class=""><em>cellId</em></td><td>)</td><td><br></td></tr></tbody></table><br></div><div><br></div><div>If your goal is just to handle the geometry you currently have once you might want to check what Paraview offers. There are a plenty addons which might do what you want.<br>
<br><br></div><div>Regards,<br></div><div> Alex<br></div><div><br></div><div><br></div><div><br></div><br><div><div><div><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Dmitry Tyulin</b> <span dir="ltr"><<a href="mailto:dmitry.tyulin@gmail.com">dmitry.tyulin@gmail.com</a>></span><br>
Date: Fri, Apr 5, 2013 at 1:17 PM<br>Subject: Re: [vtkusers] create the polydata volume from unstructured grid<br>To: Alex Malyushytskyy <<a href="mailto:alexmalvtk@gmail.com">alexmalvtk@gmail.com</a>><br><br><br><div dir="ltr">
<div><div><div>I just want to print my volume on 3D printer. In that case, I think I would be satisfied if all my cells are presented by the the set of separated triangles. That's why I want to convert vtk to stl. In my vtk file I have a tetrahedral mesh. <br>
So, there are my questions:<br>- how can I iterate over them(tetrahedrons) and create appropriate triangles?<br></div>- when i download VTK, I need to build them or just include necessary headers in my project? <br>(may be dump questions, but I am new at programming with VTK, and I don't find answers in FAQ)<br>
<br></div>Regards,<br></div>Dmitry<br></div><div class=""><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/5 Alex Malyushytskyy <span dir="ltr"><<a href="mailto:alexmalvtk@gmail.com" target="_blank">alexmalvtk@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>It is not enough details, so it is not clear what you want to do and where.<br>
<br>I assume you want to do it in your code in VTK since AFAIK Paraview has its mailing list.<br>
Then you have to remember that stl file is basically a list of triangles.<br>
</div>Questions are:<br> - do you need handle only triangles or other 2d and/or 3d cells. <br> - are you satisfied if all your cells are presented by the the set of separated triangles?<br><br></div><div>If yes:<br></div>
If your unstructured grid contains only triangles you could convert it to polydata then use vtkSTLWriter to write stl file.<br></div>if you need to support all 2D cells, you might need to use <a href="http://www.vtk.org/doc/release/4.2/html/classvtkTriangleFilter.html" target="_blank">vtkTriangleFilter<br>
</a><div><div><div><div>before vtkSTLWrite.<br></div><div>If you have 3d cells you might need iterate over them and create appropriate triangles which would describe cell surface.<br> </div><div><br></div><div>Regards,<br>
</div><div> Alex<br></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Thu, Apr 4, 2013 at 10:59 AM, Dmitry Tyulin <span dir="ltr"><<a href="mailto:dmitry.tyulin@gmail.com" target="_blank">dmitry.tyulin@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div><div><div>Hello there!<br></div>I have a volume in vtk unstructured grid. How can I convert it to CAD file format? .stl, for example. In paraview I can run Extract Surface module, but it gives to me only a surface. So, how can i convert the whole volume to .stl or .ply?<br>
<br></div>Regards,<br></div>Dmitry.<br></div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></div><br></div></div></div></div>