Hello, I am trying to extract boundary cells of a polydata. I've used <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Meshes/BoundaryEdges">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Meshes/BoundaryEdges</a> to extract boundary edges.<div>
<br></div><div>Then I looked to this example : <a href="http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Graphics/Testing/Tcl/capSphere.tcl?root=VTK&content-type=text/plain">http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Graphics/Testing/Tcl/capSphere.tcl?root=VTK&content-type=text/plain</a></div>
<div>to extract the cells.</div><div><br></div><div>But when I print the result polydata data , gives me an error.</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class="Apple-tab-span" style="white-space:pre"> </span>vtkSmartPointer<vtkFeatureEdges> boundaryEdges = vtkSmartPointer<vtkFeatureEdges>::New();<br><span class="Apple-tab-span" style="white-space:pre"> </span>boundaryEdges->SetInput(myPolyData);<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>boundaryEdges->BoundaryEdgesOn();<br><span class="Apple-tab-span" style="white-space:pre"> </span>boundaryEdges->FeatureEdgesOff();<br><span class="Apple-tab-span" style="white-space:pre"> </span>boundaryEdges->ManifoldEdgesOff();<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>boundaryEdges->NonManifoldEdgesOff();<br><span class="Apple-tab-span" style="white-space:pre"> </span>boundaryEdges->Update();<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="Apple-tab-span" style="white-space:pre"> </span>vtkSmartPointer<vtkCleanPolyData> boundaryClean = vtkSmartPointer<vtkCleanPolyData>::New();<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>boundaryClean->SetInput(boundaryEdges->GetOutput());<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="Apple-tab-span" style="white-space:pre"> </span>vtkSmartPointer<vtkStripper> boundaryStrips = vtkSmartPointer<vtkStripper>::New();<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>boundaryStrips->SetInput(boundaryClean->GetOutput());<br><span class="Apple-tab-span" style="white-space:pre"> </span>boundaryStrips->Update();<br></blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class="Apple-tab-span" style="white-space:pre"> </span>vtkSmartPointer<vtkPolyData> boundaryPoly = vtkSmartPointer<vtkPolyData>::New();<br><span class="Apple-tab-span" style="white-space:pre"> </span>boundaryPoly->SetPoints((boundaryStrips->GetOutput())->GetPoints());<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>boundaryPoly->SetPolys((boundaryStrips->GetOutput())->GetLines());<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="Apple-tab-span" style="white-space:pre"> </span>vtkSmartPointer<vtkTriangleFilter> boundaryTriangles = vtkSmartPointer<vtkTriangleFilter>::New();<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>boundaryTriangles->SetInput(boundaryPoly);<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="Apple-tab-span" style="white-space:pre"> </span>vtkSmartPointer<vtkPolyData> boundaryTrianglesPD = boundaryTriangles->GetOutput();</blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class="Apple-tab-span" style="white-space:pre"> </span>std::cout << "cell " << boundaryTrianglesPD->GetNumberOfCells() << std::endl; <font color="#ff0000">// gives me 0</font><br>
<span class="Apple-tab-span" style="white-space:pre"> </span>std::cout << "lines " << boundaryTrianglesPD->GetLines()->GetNumberOfCells() << std::endl; <font color="#ff0000">//gives me 0</font><br>
<span class="Apple-tab-span" style="white-space:pre"> </span>std::cout << "points " << boundaryTrianglesPD->GetPoints()->GetNumberOfPoints() << std::endl; <font color="#ff0000">// crash here </font></blockquote>
<div><br></div><div>Can someone help me?</div><div><br></div><div>Thank you! </div><div><br></div>-- <br>--------<br>Gonzalo Amadio<br><br>
</div>