geom/doc/salome/examples/basic_geom_objs_ex03.py

34 lines
893 B
Python
Raw Normal View History

2013-02-12 17:35:16 +06:00
# Creation of a Circle
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
p0 = geompy.MakeVertex(0., 0., 0.)
px = geompy.MakeVertex(100., 0. , 0. )
py = geompy.MakeVertex(0. , 100., 0. )
pz = geompy.MakeVertex(0. , 0. , 100.)
# create a vector on two points
vxy = geompy.MakeVector(px, py)
# create a circle from a point, a vector and a radius
circle1 = geompy.MakeCircle(pz, vxy, 30)
#create a circle from three points
circle2 = geompy.MakeCircleThreePnt(p0, px, py)
# add objects in the study
id_vxy = geompy.addToStudy(vxy, "Vector")
id_circle1 = geompy.addToStudy(circle1,"Circle1")
id_circle2 = geompy.addToStudy(circle2,"Circle2")
# display circles
gg.createAndDisplayGO(id_vxy)
gg.createAndDisplayGO(id_circle1)
gg.createAndDisplayGO(id_circle2)