# how to adjust / specify normals in programmable filter

**URL:** https://discourse.paraview.org/t/how-to-adjust-specify-normals-in-programmable-filter/10733
**Category:** ParaView Support
**Created:** [November 11, 2022, 11:22pm UTC](https://discourse.paraview.org/t/how-to-adjust-specify-normals-in-programmable-filter/10733 "2022-11-11T23:22:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![garcfd](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@garcfd](https://discourse.paraview.org/u/garcfd)
#### Post date: [November 11, 2022, 11:22pm UTC](https://discourse.paraview.org/t/how-to-adjust-specify-normals-in-programmable-filter/10733/1 "2022-11-11T23:22:10Z")

</div>

How do you adjust the Normals using programmable filter like described here  
[[Paraview] normals in programmable filter](https://www.paraview.org/pipermail/paraview/2012-June/025441.html)

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()  
od.GetPointData().ShallowCopy(id.GetPointData())  
innorm = od.GetPointData().GetNormals()  
onorm = innorm.NewInstance()  
onorm.DeepCopy(innorm)  
onorm.SetName(“NewNormals”)  
for x in range(0, onorm.GetNumberOfTuples()):  
a,b,c = onorm.GetTuple(x)  
print a,b,c  
a = -1_a  
b = -1_b  
c = -1\*c  
onorm.SetTuple3(x, a,b,c)  
od.GetPointData().SetNormals(onorm)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [November 14, 2022, 9:55am UTC](https://discourse.paraview.org/t/how-to-adjust-specify-normals-in-programmable-filter/10733/2 "2022-11-14T09:55:08Z")

</div>

Hi @garcfd

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

Best,

---

<div class="post-metadata">

### Author: ![garcfd](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@garcfd](https://discourse.paraview.org/u/garcfd)
#### Post date: [November 14, 2022, 11:58am UTC](https://discourse.paraview.org/t/how-to-adjust-specify-normals-in-programmable-filter/10733/3 "2022-11-14T11:58:59Z")

</div>

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.
