<div dir="ltr">Hello.<div>I have a method to cut a volume in a vtkUnstructuredGrid given a vtkPlane. I'm using vtkTableBasedClipDataSet to extract half of the model, also as vtkUnstructuredGrid. This is working.</div><div><br></div><div>Now, I would like to obtain ONLY the surface of the cut, than means: I want a vtkUnstructuredGrid with the nodes and faces being on the surface of the cut. </div><div>How can this be achieved?</div><div><br></div><div>I tried using vtkCutter with vtkStripper but the mesh I get doesn't have any cells, only the points and their associated data. </div><div><br></div><div>Here's how my code looks like. </div><div><br></div><div>Thank You!</div><div><br></div><div><div><font face="monospace, monospace">vtkSmartPointer<vtkUnstructuredGrid> model = vtkSmartPointer<vtkUnstructuredGrid>::New();</font></div><div><font face="monospace, monospace">// fill the ugrid ... </font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Create The Plane to cut</font></div><div><font face="monospace, monospace">vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();</font></div><div><font face="monospace, monospace">plane->SetOrigin(0.0, 0.0, 0.0);</font></div><div><font face="monospace, monospace">plane->SetNormal(1.0, 0, 0);</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Code to cut the model in half</font></div><div><font face="monospace, monospace">vtkSmartPointer<vtkTableBasedClipDataSet> clipDataSet = vtkSmartPointer<vtkTableBasedClipDataSet>::New();</font></div><div><font face="monospace, monospace">clipDataSet->SetClipFunction(plane);</font></div><div><font face="monospace, monospace">clipDataSet->InsideOutOn();</font></div><div><font face="monospace, monospace">clipDataSet->GenerateClippedOutputOn();</font></div><div><font face="monospace, monospace">clipDataSet->SetInputConnection(model->GetProducerPort());</font></div><div><font face="monospace, monospace">clipDataSet->Update();</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// This has half the model, this is Ok but not what I want</font></div><div><font face="monospace, monospace">vtkSmartPointer<vtkUnstructuredGrid> halfModel = clipDataSet->GetOutput();</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">////****////</font></div><div><font face="monospace, monospace">// BEGINS code not working to extract the surface of the cut</font></div><div><font face="monospace, monospace">vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::New();</font></div><div><font face="monospace, monospace">cutter->SetCutFunction(plane);</font></div><div><font face="monospace, monospace">cutter->SetInputConnection(model->GetProducerPort());</font></div><div><font face="monospace, monospace">cutter->Update();</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">vtkSmartPointer<vtkStripper> stripper = vtkSmartPointer<vtkStripper>::New();</font></div><div><font face="monospace, monospace">stripper->SetInputConnection(cutter->GetOutputPort());</font></div><div><font face="monospace, monospace">stripper->Update();</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">vtkSmartPointer<vtkPolyData> pd = vtkSmartPointer<vtkPolyData>::New();</font></div><div><font face="monospace, monospace">pd->SetPoints(stripper->GetOutput()->GetPoints());</font></div><div><font face="monospace, monospace">pd->SetPolys(stripper->GetOutput()->GetLines());</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">vtkSmartPointer<vtkUnstructuredGrid> clipped = vtkSmartPointer<vtkUnstructuredGrid>::New();</font></div><div><font face="monospace, monospace">clipped->ShallowCopy(pd);</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Here I see that there is no Cells</font></div><div><font face="monospace, monospace">clipped->Print(std::cout);</font></div><div><br></div><div><font face="monospace, monospace">// ENDS code to extract the surface of the cut</font></div><div><font face="monospace, monospace">////****////</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Write the unstructured grid</font></div><div><font face="monospace, monospace">vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();</font></div><div><font face="monospace, monospace">writer->SetFileName("d:/unstructuredGrid.vtu");</font></div><div><font face="monospace, monospace">writer->SetInput(clipped);</font></div><div><font face="monospace, monospace">writer->SetDataModeToAscii();</font></div><div><font face="monospace, monospace">writer->Write();</font></div><div><font face="monospace, monospace">// file doesnt have any cell, only points and pointdata</font></div></div></div>