VTK/Examples/Python/Arrays/RenameArray

From KitwarePublic
< VTK‎ | Examples‎ | Python
Jump to navigationJump to search

Works, but segfaults at the end?

RenameArray.py

import vtk
from vtk import *

#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();