I am bale to get the points like this<br><br>cutter=vtk.vtkCutter()<br> cutter.SetCutFunction(plane)<br> cutter.SetInput(vtkObject.GetOutput())<br> cutter.Update()<br><br> out=cutter.GetOutput()<br>
points=out.GetPoints()<br> NumPts=points.GetNumberOfPoints()<br> #print NumPts<br> OutlinePts=np.zeros([NumPts,3])<br> for n in range(0,NumPts,1):<br> OutlinePts[n,:]=np.round(points.GetPoint(n))<br>
<br><br>As David said, you have to call the Update method.<br><br>Jothy<br><br><div class="gmail_quote">On Thu, Feb 4, 2010 at 7:04 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria%2Bvtk@gmail.com" target="_blank">daviddoria+vtk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br>
<div class="gmail_quote"><div>On Thu, Feb 4, 2010 at 11:46 AM, Eddy Cappeau <span dir="ltr"><<a href="mailto:ecappeau@phenix-systems.com" target="_blank">ecappeau@phenix-systems.com</a>></span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">Hi,<br><br>I'm new to VTK and I'v got a little problem with it.<br>I want to cut a mesh with a plane and get the polyline of the intersection.<br>
The mesh come from a stl file loaded like this :<br><br> vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();<br> reader->SetFileName("myfile.stl");<br><br> vtkSmartPointer<vtkPolyDataMapper> stlMapper = vtkSmartPointer<vtkPolyDataMapper>::New();<br>
stlMapper->SetInputConnection(reader->GetOutputPort());<br><br>I create a cutter like this :<br><br> vtkCutter * sliceCutter = vtkCutter::New();<br> sliceCutter->SetInput( reader->GetOutput() );<br> vtkPlane *slicePlane = vtkPlane::New();<br>
slicePlane->SetOrigin(0.0,0.0,7.0);<br> slicePlane->SetNormal(0.0,0.0,1.0);<br><br> sliceCutter->SetCutFunction( slicePlane );<br><br>I'v created a mapper and an actor for the mesh and the section, and i can visualize them both.<br>
<br>So I try to retrieve the points like this :<br><br> vtkPolyData * testdata = sliceCutter->GetOutput();<br> vtkPoints * points = sliceCutter->GetOutput()->GetPoints();<br> int n = points->GetNumberOfPoints();<br>
<br>But the vtkPoints is always NULL and I don't understand why.<br>How can I get those points ?<br><br>thanks.<br>_____</blockquote>
<div> </div>
</div><div>Sounds like you need to call Update on the cutter</div>
<div>sliceCutter->Update();</div>
<div> </div>
<div>Let me know if that works.</div>
<div><br clear="all">Thanks,<br><font color="#888888"><br>David</font></div></div>
<br>_______________________________________________<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>