Hi
I am new to the community here, and I know that my question could be stupid
The problem: I want to open a “file1.vts” file and modify the “vtkPoints” using another “file2.vts” file. After that, I want to update “file1.vts” and save it.
my approach: I tried to use the documentation as follow
std::string inputFilename1 = "file1.vts";
std::string inputFilename2 = "file2.vts";
// Read the file 1
vtkNew<vtkXMLStructuredGridReader> reader1;
reader1->SetFileName(inputFilename1.c_str());
reader1->Update();
vtkNew<vtkStructuredGridGeometryFilter> geometryFilter1;
geometryFilter1->SetInputConnection(reader1->GetOutputPort());
geometryFilter1->Update();
// Read the file 2
vtkNew<vtkXMLStructuredGridReader> reader2;
reader2->SetFileName(inputFilename2.c_str());
reader2->Update();
vtkNew<vtkStructuredGridGeometryFilter> geometryFilter2;
geometryFilter2->SetInputConnection(reader2->GetOutputPort());
geometryFilter2->Update();
vtkPolyData* polydata1 = geometryFilter1->GetOutput();
vtkPolyData* polydata2 = geometryFilter2->GetOutput();
double p[3];
vtkNew<vtkPoints> points;
polydata2 = polydata1;
for (vtkIdType i = 0; i < polydata2->GetNumberOfPoints(); i++)
{
polydata2->GetPoint(i, p);
points->InsertNextPoint(p[0], p[1], p[2]);
}
polydata2->SetPoints(points);
geometryFilter2->SetOutput(polydata2);
The question: What is missing, what is next? I tried different solutions but I did not work!