geom/doc/salome/examples/normal_face.py
2021-08-12 08:45:03 +02:00

22 lines
549 B
Python

# Normal to a Face
import salome
salome.salome_init_without_session()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New()
import math
# create a box
box = geompy.MakeBoxDXDYDZ(100,30,100)
faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
face0 = faces[0]
vnorm = geompy.GetNormal(face0)
if vnorm is None:
raise RuntimeError("GetNormal(face0) failed")
else:
geompy.addToStudy(face0, "Face0")
geompy.addToStudy(vnorm, "Normale to Face0")
print("\nNormale of face has been successfully obtained")