Clipping problem with VTK 8.2, MINGW 64Bit and QT 5.14.2

I’ve been trying to clip a multi-actors mesh with clipPolyData, the expected outcome looks like as following in ParaView.


Anyway, I follow the VTK example named “CapClip” to create the clipping function , it seems that nothing appears in the screen, looks like as following.

My code:
vtkSmartPointer append = vtkSmartPointer::New();
QList<vtkSmartPointer> actorList = partActors.values();
momentCutPlane->SetNormal(dsbMomentOrientationX->value(), dsbMomentOrientationY->value(), dsbMomentOrientationZ->value());
momentCutPlane->SetOrigin(getJointVTKPolyDataOrigin());//vtkPlane
for(int i(0); i < actorList.count(); i++)
{
vtkSmartPointer clipPolyData = vtkSmartPointer::New();
// clipPolyData->SetInputData(actorList.at(i)->GetMapper()->GetInput());
clipPolyData->SetInputData(actorList.at(i)->GetMapper()->GetInputAsDataSet());
// clipPolyData->SetInputConnection(actorList.at(i)->GetMapper()->GetOutputPort());

            clipPolyData->SetClipFunction(momentCutPlane);
            clipPolyData->GenerateClipScalarsOn();
            clipPolyData->GenerateClippedOutputOn();
            clipPolyData->InsideOutOn();
            clipPolyData->Update();


            append->AddInputData(clipPolyData->GetOutput());
            if(actorList.at(i)->GetVisibility())
                actorList.at(i)->VisibilityOff();
        }
        append->Update();
        vtkSmartPointer</*vtkPolyDataMapper*/vtkDataSetMapper> clipMapper = vtkSmartPointer<vtkDataSetMapper>::New();
        clipMapper->SetInputConnection(append->GetOutputPort());
        clipMapper->ScalarVisibilityOn();
        clipMapper->SetColorModeToDefault();
        clipMapper->Update();

        if(!clipActor)
        {
            clipActor = vtkSmartPointer<vtkActor>::New();
        }
        clipActor->SetMapper(clipMapper);
        clipActor->GetProperty()->SetInterpolationToFlat();
        clipActor->GetProperty()->EdgeVisibilityOn();

        vtkSmartPointer<vtkFeatureEdges> boundaryEdges = vtkSmartPointer<vtkFeatureEdges>::New();
        boundaryEdges->SetInputData(append->GetOutput());
        boundaryEdges->BoundaryEdgesOn();
        boundaryEdges->FeatureEdgesOff();
        boundaryEdges->NonManifoldEdgesOff();
        boundaryEdges->ManifoldEdgesOff();

        vtkSmartPointer<vtkStripper> boundaryStrips = vtkSmartPointer<vtkStripper>::New();
        boundaryStrips->SetInputConnection(boundaryEdges->GetOutputPort());
        boundaryStrips->Update();

        vtkSmartPointer<vtkPolyData> boundaryPoly = vtkSmartPointer<vtkPolyData>::New();
        boundaryPoly->SetPoints(boundaryStrips->GetOutput()->GetPoints());
        boundaryPoly->SetPolys(boundaryStrips->GetOutput()->GetLines());

        vtkSmartPointer<vtkPolyDataMapper> boundaryMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
        boundaryMapper->SetInputData(boundaryPoly);
        boundaryMapper->ScalarVisibilityOn();
        boundaryMapper->SetColorModeToDefault();

        if(!boundaryActor)
        {
            boundaryActor = vtkSmartPointer<vtkActor>::New();
        }
        boundaryActor->SetMapper(boundaryMapper);

        if(momentPostWidget->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActors()->IsItemPresent(clipActor) == 0)
            momentPostWidget->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(clipActor);
        else
            clipActor->VisibilityOn();

        if(momentPostWidget->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActors()->IsItemPresent(boundaryActor) == 0)
            momentPostWidget->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(boundaryActor);
        else
            boundaryActor->VisibilityOn();

        momentPostWidget->GetRenderWindow()->Render();

Any suggestion or comment is welcome!

Seems this problem is solved partially.
Now the mesh is clipped with vtkClipClosedSurface, the result looks like:


Only some of the clipped cells are closed on the boundary. Class vtkFeatureEdges is used to detect the unclosed holes, and the number of cells in vtkFeatureEdges supports that most of the clipped cells are not closed.
Code:
vtkNew clipPolydata;
vtkNew collection;
collection->AddItem(momentCutPlane);
clipPolydata->SetClippingPlanes(collection);
clipPolydata->SetInputData(convertVTKDatasetToVTKPolyData(partActors.value(keys.at(i))->GetMapper()->GetInputAsDataSet()));
clipPolydata->SetTolerance(1.0e-8);
clipPolydata->Update();
convertVTKDatasetToVTKPolyData is a function to convert vtkDataSet to vtkPolyData, which is not efficient。 Could anyone provide a bettter way to do so? Seems vtkPolyData::SafeDownCast(vtkDataSet) does not work in my code, and could cause the application crash.