how to adjust / specify normals in programmable filter

How do you adjust the Normals using programmable filter like described here
[Paraview] normals in programmable filter

I have been using the script below, but get the following error message
AttributeError: ‘NoneType’ object has no attribute ‘NewInstance’

od = self.GetOutput()
id = self.GetInput()
innorm = od.GetPointData().GetNormals()
onorm = innorm.NewInstance()
for x in range(0, onorm.GetNumberOfTuples()):
a,b,c = onorm.GetTuple(x)
print a,b,c
a = -1a
b = -1
c = -1*c
onorm.SetTuple3(x, a,b,c)

Hi @garcfd

od point data do not contains normals, so your innorm is empty


Hi Matt, thanks for the reply. I have a vtk file which is a slice of mesh (from openfoam sampling), with velocity values. Couple of the cells have wrong normal, since the colouring is off. I can reverse all the normals. If I triangulate the mesh it fixes the problem, but I dont want to do that. So basically I want to be able to loop through the cells and set all the normals in same direction. If you have any idea how to do that - it would be useful, Thanks Giles.