裁剪更改不影响 vtk 中的输入

Clipping changes are not affecting in the input in vtk

我正在开发一个示例应用程序,其中我使用 vtkplanes 裁剪 surfaceRendered 输出。

更改在 vtkRenderWindow 上清晰可见,没有任何问题,但是当我将其转换为 stl 文件时,裁剪的更改不是保存而不是在我进行裁剪之前保存 3D 对象。

这是我的代码

mapper->SetInputConnection( surfaceRenderedOutput->GetOutputPort() );
mapper->AddClippingPlane( plane6 );
mapper->AddClippingPlane( plane1 );
mapper->AddClippingPlane( plane2 );
mapper->AddClippingPlane( plane3 );
mapper->AddClippingPlane( plane5 );
mapper->AddClippingPlane( plane4 );
mapper->Update();


surfaceRenderedOutput->SetInputConnection(mapperr->GetOutputPort());
surfaceRenderedOutput->Update();

为了写入 stl,我是这样使用的

          stlWriter->SetInput(surfaceRenderedOutput->GetOutput());
            stlWriter->Write();

谁能帮忙

编辑

我喜欢这个

       //vtkClipPolyData//
     clipper1->SetClipFunction(plane1);
      clipper2->SetClipFunction(plane2);
       clipper3->SetClipFunction(plane3);
        clipper4->SetClipFunction(plane4);
        clipper5->SetClipFunction(plane5);
        clipper6->SetClipFunction(plane6);

            polyd1=clipper1->GetOutput();
            polyd2=clipper2->GetOutput();
            polyd3=clipper3->GetOutput();
            polyd4=clipper4->GetOutput();
            polyd5=clipper5->GetOutput();
            polyd6=clipper6->GetOutput();

vtkSmartPointer<vtkAppendPolyData> appendFilter = 
   vtkSmartPointer<vtkAppendPolyData>::New();
        appendFilter->SetNumberOfInputs(6);
        appendFilter->AddInput(polyd1);
        appendFilter->AddInput(polyd2);
        appendFilter->AddInput(polyd3);
        appendFilter->AddInput(polyd4);
        appendFilter->AddInput(polyd5);
        appendFilter->AddInput(polyd6);
        appendFilter->Update();


       stlWriter->SetInput(appendFilter->GetOutput());

我仍然没有得到输出

映射器不对 surfaceRenderedOutput 做任何事情。映射器的输出可能会转到 vtkActor,然后再转到 vtkRenderWindow。

您需要映射器的输出。它的类型是什么?

对于 vtkClipPolyData 对象,有一个 getClippedOutput 方法可以让您获得裁剪的网格。