Salome HOME
79ae725c5b576afc71fc081ae696542b542e2547
[modules/geom.git] / doc / salome / examples / normal_face.py
1 # Normal to a Face
2
3 import salome
4 salome.salome_init_without_session()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
8 import math
9
10 # create a box
11 box = geompy.MakeBoxDXDYDZ(100,30,100)
12
13 faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
14 face0 = faces[0]
15 vnorm = geompy.GetNormal(face0)
16 if vnorm is None:
17   raise RuntimeError("GetNormal(face0) failed")
18 else:
19   geompy.addToStudy(face0, "Face0")
20   geompy.addToStudy(vnorm, "Normale to Face0")
21   print("\nNormale of face has been successfully obtained")