geom/doc/salome/examples/primitives_ex07.py

35 lines
866 B
Python
Raw Permalink Normal View History

2013-02-12 17:35:16 +06:00
# Creation of a Rectangle
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
2017-06-13 14:57:14 +05:00
geompy = geomBuilder.New()
2013-02-12 17:35:16 +06:00
gg = salome.ImportComponentGUI("GEOM")
# create vertices
px = geompy.MakeVertex(100., 0. , 0. )
py = geompy.MakeVertex(0. , 100., 0. )
# create a vector on two points
vxy = geompy.MakeVector(px, py)
# create a rectangle in OXY plane
face1 = geompy.MakeFaceHW(100, 100, 1)
# create a rectangle using normal vector
face2 = geompy.MakeFaceObjHW(vxy, 50, 150)
# create a rectangle from other face
face3 = geompy.MakeFaceObjHW(face2, 150, 50)
# add objects in the study
id_face1 = geompy.addToStudy(face1,"Face1")
id_face2 = geompy.addToStudy(face2,"Face2")
id_face3 = geompy.addToStudy(face3,"Face3")
# display rectangles
gg.createAndDisplayGO(id_face1)
gg.createAndDisplayGO(id_face2)
gg.createAndDisplayGO(id_face3)