<br><br>
<div class="gmail_quote">On Thu, Feb 4, 2010 at 11:46 AM, Eddy Cappeau <span dir="ltr"><<a href="mailto:ecappeau@phenix-systems.com">ecappeau@phenix-systems.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; 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>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><br>David</div></div>