<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">You're rigth.
It works fine now.
Thanks.
Eddy
----
</pre>
<blockquote>
<pre wrap="">Date: Fri, 5 Feb 2010 10:15:53 +0000
From: KS Jothybasu <a class="moz-txt-link-rfc2396E"
href="mailto:jothybasu@gmail.com"><jothybasu@gmail.com></a>
Subject: Re: [vtkusers] get points of a cutter
To: David Doria <a class="moz-txt-link-rfc2396E"
href="mailto:daviddoria+vtk@gmail.com"><daviddoria+vtk@gmail.com></a>
Cc: <a class="moz-txt-link-abbreviated" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>
Message-ID:
        <a class="moz-txt-link-rfc2396E"
href="mailto:1dd3c8b21002050215h6767849bqcc8b96d00512307a@mail.gmail.com"><1dd3c8b21002050215h6767849bqcc8b96d00512307a@mail.gmail.com></a>
Content-Type: text/plain; charset="iso-8859-1"
I am bale to get the points like this
cutter=vtk.vtkCutter()
cutter.SetCutFunction(plane)
cutter.SetInput(vtkObject.GetOutput())
cutter.Update()
out=cutter.GetOutput()
points=out.GetPoints()
NumPts=points.GetNumberOfPoints()
#print NumPts
OutlinePts=np.zeros([NumPts,3])
for n in range(0,NumPts,1):
OutlinePts[n,:]=np.round(points.GetPoint(n))
As David said, you have to call the Update method.
Jothy
On Thu, Feb 4, 2010 at 7:04 PM, David Doria
<<a class="moz-txt-link-abbreviated"
href="mailto:daviddoria+vtk@gmail.com">daviddoria+vtk@gmail.com</a><a
class="moz-txt-link-rfc2396E" href="mailto:daviddoria%2Bvtk@gmail.com"><daviddoria%2Bvtk@gmail.com></a>
</pre>
<blockquote type="cite" style="color: rgb(0, 0, 0);">
<pre wrap=""><span class="moz-txt-citetags">> </span>wrote:
</pre>
</blockquote>
<blockquote type="cite" style="color: rgb(0, 0, 0);">
<pre wrap=""><span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>On Thu, Feb 4, 2010 at 11:46 AM, Eddy Cappeau <<a
class="moz-txt-link-abbreviated"
href="mailto:ecappeau@phenix-systems.com">ecappeau@phenix-systems.com</a>
</pre>
<blockquote type="cite" style="color: rgb(0, 0, 0);">
<pre wrap=""><span class="moz-txt-citetags">> > </span>wrote:
</pre>
</blockquote>
<pre wrap=""><span class="moz-txt-citetags">></span>
</pre>
<blockquote type="cite" style="color: rgb(0, 0, 0);">
<pre wrap=""><span class="moz-txt-citetags">>> </span>Hi,
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span>I'm new to VTK and I'v got a little problem with it.
<span class="moz-txt-citetags">>> </span>I want to cut a mesh with a plane and get the polyline of the
<span class="moz-txt-citetags">>> </span>intersection.
<span class="moz-txt-citetags">>> </span>The mesh come from a stl file loaded like this :
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span> vtkSmartPointer<vtkSTLReader> reader =
<span class="moz-txt-citetags">>> </span>vtkSmartPointer<vtkSTLReader>::New();
<span class="moz-txt-citetags">>> </span> reader->SetFileName("myfile.stl");
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span> vtkSmartPointer<vtkPolyDataMapper> stlMapper =
<span class="moz-txt-citetags">>> </span>vtkSmartPointer<vtkPolyDataMapper>::New();
<span class="moz-txt-citetags">>> </span> stlMapper->SetInputConnection(reader->GetOutputPort());
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span>I create a cutter like this :
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span> vtkCutter * sliceCutter = vtkCutter::New();
<span class="moz-txt-citetags">>> </span> sliceCutter->SetInput( reader->GetOutput() );
<span class="moz-txt-citetags">>> </span> vtkPlane *slicePlane = vtkPlane::New();
<span class="moz-txt-citetags">>> </span> slicePlane->SetOrigin(0.0,0.0,7.0);
<span class="moz-txt-citetags">>> </span> slicePlane->SetNormal(0.0,0.0,1.0);
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span> sliceCutter->SetCutFunction( slicePlane );
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span>I'v created a mapper and an actor for the mesh and the section, and i can
<span class="moz-txt-citetags">>> </span>visualize them both.
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span>So I try to retrieve the points like this :
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span> vtkPolyData * testdata = sliceCutter->GetOutput();
<span class="moz-txt-citetags">>> </span> vtkPoints * points = sliceCutter->GetOutput()->GetPoints();
<span class="moz-txt-citetags">>> </span> int n = points->GetNumberOfPoints();
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span>But the vtkPoints is always NULL and I don't understand why.
<span class="moz-txt-citetags">>> </span>How can I get those points ?
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>> </span>thanks.
<span class="moz-txt-citetags">>> </span>_____
</pre>
</blockquote>
<pre wrap=""><span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>Sounds like you need to call Update on the cutter
<span class="moz-txt-citetags">> </span>sliceCutter->Update();
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>Let me know if that works.
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>Thanks,
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>David
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>_______________________________________________
<span class="moz-txt-citetags">> </span>Powered by <a
class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>Visit other Kitware open-source projects at
<span class="moz-txt-citetags">> </span><a
class="moz-txt-link-freetext"
href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>Please keep messages on-topic and check the VTK FAQ at:
<span class="moz-txt-citetags">> </span><a
class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>Follow this link to subscribe/unsubscribe:
<span class="moz-txt-citetags">> </span><a
class="moz-txt-link-freetext"
href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">></span>
</pre>
</blockquote>
<pre wrap="">-------------- next part --------------
An HTML attachment was scrubbed...
URL: <a class="moz-txt-link-rfc2396E"
href="http://www.vtk.org/pipermail/vtkusers/attachments/20100205/f9c8a11c/attachment-0001.htm"><http://www.vtk.org/pipermail/vtkusers/attachments/20100205/f9c8a11c/attachment-0001.htm></a>
</pre>
</blockquote>
</body>
</html>