# How to find normal to plane using script?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 16, 2017, 08:44 How to find normal to plane using script? #1 New Member   Renuka Join Date: Aug 2017 Posts: 15 Rep Power: 7 If I have a plane, is there a quick way to get the normal vector? (just a simple plane, no surface, no edges or points). def main(): # creating a plane x1,y1,z1=500,90,200 x2,y2,z2=50,100,200 x3,y3,z3=600,30,45 plane_1=base.CreateWplane3Points(x1,y1,z1,x2,y2,z2 ,x3,y3,z3)

 September 16, 2017, 13:28 Normal plane to three points #2 New Member   Join Date: Sep 2017 Posts: 5 Rep Power: 7 Hi, I am new to this forum. And glad to help you on this one. Function takes 3 point ordinates [x1,y1,z1],[x2,y2,z2],[x3,y3,z3]. And returns unit vector for the plane formed by the 3 points Code: ```import ansa def normalVector2Plane(pnt1,pnt2,pnt3):# 3 points def vector(point1,point2): delx=point2[0]-point1[0] dely=point2[1]-point1[1] delz=point2[2]-point1[2] magnitude=(delx*delx+dely*dely+delz*delz)**0.5 # Distance from Distance Formula if(magnitude!=0): x=delx/magnitude y=dely/magnitude z=delz/magnitude return [x, y, z] # Unit Vecor else: return 0 a = vector(pnt1, pnt2) b = vector(pnt1, pnt3) return ansa.calc.CrossProduct(a, b) # Cross Product of 2 Vectors```

September 16, 2017, 15:27
#3
New Member

Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 7
Quote:
 Originally Posted by maddoxx Hi, I am new to this forum. And glad to help you on this one. Function takes 3 point ordinates [x1,y1,z1],[x2,y2,z2],[x3,y3,z3]. And returns unit vector for the plane formed by the 3 points Code: ```import ansa def normalVector2Plane(pnt1,pnt2,pnt3):# 3 points def vector(point1,point2): delx=point2[0]-point1[0] dely=point2[1]-point1[1] delz=point2[2]-point1[2] magnitude=(delx*delx+dely*dely+delz*delz)**0.5 # Distance from Distance Formula if(magnitude!=0): x=delx/magnitude y=dely/magnitude z=delz/magnitude return [x, y, z] # Unit Vecor else: return 0 a = vector(pnt1, pnt2) b = vector(pnt1, pnt3) return ansa.calc.CrossProduct(a, b) # Cross Product of 2 Vectors```
Thank you I will try it.