在vtk中的输入中,剪裁的变化不受影响。

问题描述 投票:0回答:1

我正在开发一个示例应用程序,其中我使用了 vtkplanes 裁剪 渲染表面 输出。

这些变化在 vtkRenderWindow 清楚地没有任何问题,但当我把它转换为 栈桥 文件中,裁剪后的变化没有被保存,而是在我进行裁剪前保存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());

还是没有得到输出

visual-studio vtk
1个回答
0
投票

mapper没有对surfaceRenderedOutput做任何处理。 mapper的输出可能会进入vtkActor,然后再进入vtkRenderWindow。

你想要的是mapper的输出。 它的类型是什么?

对于vtkClipPolyData对象,有一个getClippedOutput方法,它应该允许你得到一个剪切的网格。

© www.soinside.com 2019 - 2024. All rights reserved.