Sorry for asking so directly like this, but, Is there another way of doing this?<br><br>Because the result obtained is not the desired. <div><br></div><div>Thank you.!<br><br><div class="gmail_quote">2012/8/13 David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Aug 13, 2012 at 12:10 PM, Gonzalo Amadio<br>
<<a href="mailto:gonzaloamadio@gmail.com">gonzaloamadio@gmail.com</a>> wrote:<br>
> Hello, I am trying to extract boundary cells of a polydata. I've used<br>
> <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Meshes/BoundaryEdges" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Meshes/BoundaryEdges</a> to extract<br>
> boundary edges.<br>
><br>
> Then I looked to this example :<br>
> <a href="http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Graphics/Testing/Tcl/capSphere.tcl?root=VTK&content-type=text/plain" target="_blank">http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Graphics/Testing/Tcl/capSphere.tcl?root=VTK&content-type=text/plain</a><br>
> to extract the cells.<br>
><br>
> But when I print the result polydata data , gives me an error.<br>
><br>
>> vtkSmartPointer<vtkFeatureEdges> boundaryEdges =<br>
>> vtkSmartPointer<vtkFeatureEdges>::New();<br>
>> boundaryEdges->SetInput(myPolyData);<br>
>> boundaryEdges->BoundaryEdgesOn();<br>
>> boundaryEdges->FeatureEdgesOff();<br>
>> boundaryEdges->ManifoldEdgesOff();<br>
>> boundaryEdges->NonManifoldEdgesOff();<br>
>> boundaryEdges->Update();<br>
>><br>
>><br>
>><br>
>> vtkSmartPointer<vtkCleanPolyData> boundaryClean =<br>
>> vtkSmartPointer<vtkCleanPolyData>::New();<br>
>> boundaryClean->SetInput(boundaryEdges->GetOutput());<br>
>><br>
>><br>
>> vtkSmartPointer<vtkStripper> boundaryStrips =<br>
>> vtkSmartPointer<vtkStripper>::New();<br>
>> boundaryStrips->SetInput(boundaryClean->GetOutput());<br>
>> boundaryStrips->Update();<br>
>><br>
>><br>
>><br>
>> vtkSmartPointer<vtkPolyData> boundaryPoly =<br>
>> vtkSmartPointer<vtkPolyData>::New();<br>
>> boundaryPoly->SetPoints((boundaryStrips->GetOutput())->GetPoints());<br>
>> boundaryPoly->SetPolys((boundaryStrips->GetOutput())->GetLines());<br>
>><br>
>><br>
>><br>
>> vtkSmartPointer<vtkTriangleFilter> boundaryTriangles =<br>
>> vtkSmartPointer<vtkTriangleFilter>::New();<br>
>> boundaryTriangles->SetInput(boundaryPoly);<br>
>><br>
>><br>
>><br>
>> vtkSmartPointer<vtkPolyData> boundaryTrianglesPD =<br>
>> boundaryTriangles->GetOutput();<br>
>><br>
>><br>
>><br>
>> std::cout << "cell " << boundaryTrianglesPD->GetNumberOfCells() <<<br>
>> std::endl; // gives me 0<br>
>> std::cout << "lines " <<<br>
>> boundaryTrianglesPD->GetLines()->GetNumberOfCells() << std::endl;<br>
>> //gives me 0<br>
>> std::cout << "points " <<<br>
>> boundaryTrianglesPD->GetPoints()->GetNumberOfPoints() << std::endl; //<br>
>> crash here<br>
><br>
><br>
> Can someone help me?<br>
><br>
> Thank you!<br>
><br>
> --<br>
> --------<br>
> Gonzalo Amadio<br>
<br>
</div></div>You need to call boundaryTriangles->Update() before<br>
boundaryTriangles->GetOutput() if you're going to use it like this.<br>
<span class="HOEnZb"><font color="#888888"><br>
David<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>--------<br>Gonzalo Amadio<br><br>
</div>