RenameArray

VTKEx/Python/Arrays/RenameArray

Description

Works, but segfaults at the end?

Question

If you have a simple question about this example contact us at VTKExProject If your question is more complex and may require extended discussion, please use the VTK Discourse Forum

Code

RenameArray.py

import vtk


def main():
    # setup sphere
    sphereSource = vtk.vtkSphereSource()
    sphereSource.Update()

    polydata = vtk.vtkPolyData()
    polydata.ShallowCopy(sphereSource.GetOutput())

    normals = polydata.GetPointData().GetNormals()
    normals.SetName("TestN")

    writer = vtk.vtkXMLPolyDataWriter()
    writer.SetFileName("Test.vtp")
    writer.SetInput(polydata)
    writer.Write()


if __name__ == '__main__':
    main()