QString filePathDown = "D://xxstl";
vSPNew(stlReader, vtkSTLReader);
stlReader->SetFileName(filePathDown.toLatin1().data());
stlReader->Update();
vSPNew(decimate, vtkDecimatePro);
decimate->SetInputData(stlReader->GetOutput());
decimate->SetTargetReduction(0.9); //10% reduction (if there was 100 triangles, now there will be 90)
decimate->Update();
vSPNew(stlWriter, vtkSTLWriter);
stlWriter->SetFileName(filePathDown.toLatin1().data());
stlWriter->SetInputData(decimate->GetOutput());
stlWriter->Update();
stlWriter->Write();
vSPNew(stlReader, vtkSTLReader);
stlReader->SetFileName(filePathDown.toLatin1().data());
stlReader->Update();
vSPNew(decimate, vtkDecimatePro);
decimate->SetInputData(stlReader->GetOutput());
decimate->SetTargetReduction(0.9); //10% reduction (if there was 100 triangles, now there will be 90)
decimate->Update();
vSPNew(stlWriter, vtkSTLWriter);
stlWriter->SetFileName(filePathDown.toLatin1().data());
stlWriter->SetInputData(decimate->GetOutput());
stlWriter->Update();
stlWriter->Write();