+ vtkCleanPolyData *connectivityClean = vtkCleanPolyData::New();
+ connectivityClean->SetInputData( connectivity->GetOutput() );
+ connectivityClean->Update();
+
+ //step 6.1. -- connect both meshes Patch->ConnectivityClean --
+ Stretch( connectivityClean->GetOutput() , bbGetInputPatch() );
+ //step 6.2. -- connect both meshes ConnectivityClean->Patch --
+ Stretch( bbGetInputPatch(), connectivityClean->GetOutput() );
+
+ /*
+ //step 6.1. -- connect both meshes Patch->ConnectivityClean --
+ vtkIdFilter *idFilter = vtkIdFilter::New();
+ idFilter->SetInputData( bbGetInputPatch() );
+ //idFilter->SetIdsArrayName("ids");
+ //idFilter->SetCellIdsArrayName("ids");
+ idFilter->SetPointIdsArrayName("ids");
+ idFilter->SetPointIds(true);
+ idFilter->SetCellIds(false);
+//# Available for vtk>=8.3:
+// #idFilter.SetPointIdsArrayName(arrayName)
+// #idFilter.SetCellIdsArrayName(arrayName)
+ idFilter->Update();
+ vtkFeatureEdges *edges = vtkFeatureEdges::New();
+ edges->SetInputData( idFilter->GetOutput() );
+ edges->BoundaryEdgesOn();
+ edges->ManifoldEdgesOff();
+ edges->NonManifoldEdgesOff();
+ edges->FeatureEdgesOff();
+ edges->Update();
+ vtkIdTypeArray* arrayIds = vtkIdTypeArray::SafeDownCast(edges->GetOutput()->GetPointData()->GetArray("ids"));
+ long int iIds,sizeArrayIds = edges->GetOutput()->GetNumberOfPoints();
+printf("\n EED CleanMeshWithPatch::Process sizeArrayIds=%ld \n", sizeArrayIds);
+
+
+ vtkPolyData *newMesh = connectivityClean->GetOutput();
+ vtkStaticPointLocator *pointLocator2 = vtkStaticPointLocator::New();
+ pointLocator2->SetDataSet( newMesh );
+ pointLocator2->BuildLocator();
+ vtkPoints *pointsPatch = bbGetInputPatch()->GetPoints();
+ vtkPoints *pointsNewMesh = newMesh->GetPoints();
+ double pP[3], pPP[3];
+ long int idNewMesh;
+ for (iIds=0; iIds<sizeArrayIds ; iIds++ )
+ {
+ pointsPatch->GetPoint( arrayIds->GetValue(iIds) , pP );
+ idNewMesh = pointLocator2->FindClosestPoint(pP);
+ pointsNewMesh->GetPoint( idNewMesh , pPP );
+ pointsPatch->SetPoint( arrayIds->GetValue(iIds) , pPP );
+ printf(" iIds=%ld pP=%f %f %f idNewMesh=%ld pPP=%f %f %f \n", arrayIds->GetValue(iIds) , pP[0], pP[1], pP[2], idNewMesh, pPP[0], pPP[1], pPP[2] );
+ } // for iIds
+ bbGetInputPatch()->Modified();
+
+ //step 6.2. -- connect both meshes ConnectivityClean->Patch --
+ vtkIdFilter *idFilter2 = vtkIdFilter::New();
+ idFilter2->SetInputData( newMesh );
+ //idFilter->SetIdsArrayName("ids");
+ //idFilter->SetCellIdsArrayName("ids");
+ idFilter2->SetPointIdsArrayName("ids");
+ idFilter2->SetPointIds(true);
+ idFilter2->SetCellIds(false);
+//# Available for vtk>=8.3:
+// #idFilter.SetPointIdsArrayName(arrayName)
+// #idFilter.SetCellIdsArrayName(arrayName)
+ idFilter2->Update();
+ vtkFeatureEdges *edges2 = vtkFeatureEdges::New();
+ edges2->SetInputData( idFilter2->GetOutput() );
+ edges2->BoundaryEdgesOn();
+ edges2->ManifoldEdgesOff();
+ edges2->NonManifoldEdgesOff();
+ edges2->FeatureEdgesOff();
+ edges2->Update();
+ vtkIdTypeArray* arrayIds2 = vtkIdTypeArray::SafeDownCast(edges2->GetOutput()->GetPointData()->GetArray("ids"));
+ long int iIds2,sizeArrayIds2 = edges2->GetOutput()->GetNumberOfPoints();
+printf("\n EED CleanMeshWithPatch::Process sizeArrayIds2=%ld \n", sizeArrayIds2);
+// vtkPolyData *newMesh = connectivityClean->GetOutput();
+ vtkStaticPointLocator *pointLocator3 = vtkStaticPointLocator::New();
+ pointLocator3->SetDataSet( bbGetInputPatch() );
+ pointLocator3->BuildLocator();
+ vtkPoints *pointsNewMesh2 = newMesh->GetPoints();
+ vtkPoints *pointsPatch2 = bbGetInputPatch()->GetPoints();
+ double pP2[3], pPP2[3];
+ long int idPatch;
+ for (iIds2=0; iIds2<sizeArrayIds2 ; iIds2++ )
+ {
+ pointsNewMesh2->GetPoint( arrayIds2->GetValue(iIds2) , pP2 );
+ idPatch = pointLocator3->FindClosestPoint(pP2);
+ pointsPatch2->GetPoint( idPatch , pPP2 );
+ pointsNewMesh2->SetPoint( arrayIds2->GetValue(iIds) , pPP2 );
+ printf(" iIds=%ld pP=%f %f %f idNewMesh=%ld pPP=%f %f %f \n", arrayIds2->GetValue(iIds) , pP2[0], pP2[1], pP2[2], idPatch, pPP2[0], pPP2[1], pPP2[2] );
+ } // for iIds
+ newMesh->Modified();
+*/
+
+
+ // step 7. -- Append meshes--