Helper for edges and faces extraction
(data: vtkPolyData)
| 14 | |
| 15 | |
| 16 | def extractEdgesFaces(data: vtkPolyData) -> tuple[vtkPolyData, vtkPolyData]: |
| 17 | """Helper for edges and faces extraction""" |
| 18 | |
| 19 | # extract edges |
| 20 | extr = vtkExtractCellsByType() |
| 21 | extr.SetInputDataObject(data) |
| 22 | |
| 23 | extr.AddCellType(VTK_LINE) |
| 24 | extr.AddCellType(VTK_POLY_LINE) |
| 25 | extr.AddCellType(VTK_VERTEX) |
| 26 | extr.Update() |
| 27 | data_edges = extr.GetOutput() |
| 28 | |
| 29 | # extract faces |
| 30 | extr = vtkExtractCellsByType() |
| 31 | extr.SetInputDataObject(data) |
| 32 | |
| 33 | extr.AddCellType(VTK_TRIANGLE) |
| 34 | extr.Update() |
| 35 | data_faces = extr.GetOutput() |
| 36 | |
| 37 | # remove normals from edges |
| 38 | data_edges.GetPointData().RemoveArray("Normals") |
| 39 | |
| 40 | return data_edges, data_faces |
| 41 | |
| 42 | |
| 43 | def exportVTP( |