2013-02-12 17:35:16 +06:00
|
|
|
# Normal to a Face
|
|
|
|
|
2013-04-04 13:06:43 +06:00
|
|
|
import salome
|
|
|
|
salome.salome_init()
|
|
|
|
import GEOM
|
|
|
|
from salome.geom import geomBuilder
|
|
|
|
geompy = geomBuilder.New(salome.myStudy)
|
2013-02-12 17:35:16 +06:00
|
|
|
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:
|
2017-02-10 21:07:24 +05:00
|
|
|
raise RuntimeError("GetNormal(face0) failed")
|
2013-02-12 17:35:16 +06:00
|
|
|
else:
|
|
|
|
geompy.addToStudy(face0, "Face0")
|
|
|
|
geompy.addToStudy(vnorm, "Normale to Face0")
|
2017-02-10 21:07:24 +05:00
|
|
|
print("\nNormale of face has been successfully obtained")
|