<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#003333" bgcolor="#FFFFFF">
Hi<br>
Let me add my test code to my previous message:<br>
<br>
<br>
vtkSmartPointer<vtkStructuredGrid> structuredGrid =<br>
vtkSmartPointer<vtkStructuredGrid>::New();<br>
<br>
vtkSmartPointer<vtkPoints> points =<br>
vtkSmartPointer<vtkPoints>::New();<br>
<br>
const int Size=20;<br>
<br>
int i, j, k;<br>
<br>
for(k = 0; k < Size; k++)<br>
for(j = 0; j < Size; j++)<br>
for(i = 0; i < Size; i++)<br>
points->InsertNextPoint(i, j, k);<br>
<br>
// Specify the dimensions of the grid<br>
structuredGrid->SetDimensions(Size,Size,Size);<br>
structuredGrid->SetPoints(points);<br>
<br>
// Cutter<br>
<br>
#if 0<br>
vtkSmartPointer<vtkPlane> plane =<br>
vtkSmartPointer<vtkPlane>::New();<br>
plane->SetOrigin(Size/2,0,0);<br>
plane->SetNormal(1,0,0);<br>
#else<br>
const int N=3;<br>
<br>
const double Step10=(Size-1)/10.0;<br>
<br>
vtkPoints *cutPts = vtkPoints::New();<br>
cutPts->SetNumberOfPoints(N);<br>
<br>
{<br>
i=0;<br>
cutPts->SetPoint(i++, 1*Step10, 1*Step10, 0);<br>
cutPts->SetPoint(i++, 5*Step10, 5*Step10, 0);<br>
cutPts->SetPoint(i++, 5*Step10, 8*Step10, 0);<br>
ASSERT(i==N);<br>
}<br>
<br>
int* idCutPts = new int[N];<br>
for(i = 0; i < N; i++)<br>
idCutPts[i] = i;<br>
<br>
vtkSmartPointer<vtkPolyLine> PolyLine =<br>
vtkSmartPointer<vtkPolyLine>::New();<br>
PolyLine->Initialize(N, idCutPts, cutPts);<br>
<br>
vtkSmartPointer<vtkPolyPlane> plane =<br>
vtkSmartPointer<vtkPolyPlane>::New();<br>
plane->SetPolyLine(PolyLine);<br>
<br>
#endif<br>
<br>
vtkSmartPointer<vtkCutter> cutter =<br>
vtkSmartPointer<vtkCutter>::New();<br>
cutter->SetCutFunction(plane);<br>
cutter->SetInputData(structuredGrid);<br>
cutter->Update();<br>
<br>
vtkSmartPointer<vtkPolyDataMapper> cutterMapper =<br>
vtkSmartPointer<vtkPolyDataMapper>::New();<br>
cutterMapper->SetInputConnection(
cutter->GetOutputPort());<br>
<br>
// Create plane actor<br>
vtkSmartPointer<vtkActor> planeActor =<br>
vtkSmartPointer<vtkActor>::New();<br>
planeActor->GetProperty()->SetColor(1.0,1.0,0);<br>
planeActor->GetProperty()->SetLineWidth(2);<br>
planeActor->SetMapper(cutterMapper);<br>
<br>
// Create a mapper and actor<br>
vtkSmartPointer<vtkDataSetMapper> mapper =<br>
vtkSmartPointer<vtkDataSetMapper>::New();<br>
#if VTK_MAJOR_VERSION <= 5<br>
mapper->SetInputConnection(structuredGrid->GetProducerPort());<br>
#else<br>
mapper->SetInputData(structuredGrid);<br>
#endif<br>
<br>
vtkSmartPointer<vtkActor> actor =<br>
vtkSmartPointer<vtkActor>::New();<br>
actor->SetMapper(mapper);<br>
actor->GetProperty()->SetRepresentationToWireframe();<br>
<br>
// Create a renderer, render window, and interactor<br>
vtkSmartPointer<vtkRenderer> renderer =<br>
vtkSmartPointer<vtkRenderer>::New();<br>
vtkSmartPointer<vtkRenderWindow> renderWindow =<br>
vtkSmartPointer<vtkRenderWindow>::New();<br>
renderWindow->AddRenderer(renderer);<br>
vtkSmartPointer<vtkRenderWindowInteractor>
renderWindowInteractor =<br>
vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
<br>
// Add the actor to the scene<br>
renderer->AddActor(actor);<br>
renderer->AddActor(planeActor);<br>
renderer->SetBackground(.3, .6, .3); // Background color<br>
<br>
// Render and interact<br>
renderWindow->Render();<br>
renderWindowInteractor->Start();<br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">Il 05/04/2017 10:48, Matteo via
vtkusers ha scritto:<br>
</div>
<blockquote cite="mid:58E4AF41.7040100@yahoo.it" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
Hi<br>
I need to use vtkCutter to cut a vtkStructuredGrid, but not using
a simple vtkPlane: what I need is something more complex.<br>
I need to use a polyline, and extrude it on Z direction, to
specify a surface more complex then a simple vtkPlane.<br>
It looks that vtkPolyPlane is what I need, but when I use it I
have a problem: the cut is done quite correctly along the polyline
specified, but also appear some other piece of cut in some other
position.<br>
The picture attached shows the problem.<br>
I tried more grid sizes, and different polylines (different length
or shapes), but there is quite always this strange extra surfaces
added.<br>
I am not sure if it is a correct result of this filter.... or a
bug.<br>
Anyone can help?<br>
Matteo<br>
<br>
<img src="cid:part1.02020809.09020402@yahoo.it" alt=""><br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Search the list archives at: <a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/vtkusers">http://public.kitware.com/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
</body>
</html>