geom/doc/salome/examples/basic_geom_objs_ex07.py
2013-02-12 11:35:16 +00:00

28 lines
740 B
Python

# Creation of a Vector
import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
# create vertices
p1 = geompy.MakeVertex(10., 50., 20.)
p2 = geompy.MakeVertex(70., 70., 70.)
# create a vector from two points
vector1 = geompy.MakeVector(p1, p2)
# create a vector from the given components
vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
# add objects in the study
id_p1 = geompy.addToStudy(p1, "Point1")
id_p2 = geompy.addToStudy(p2, "Point2")
id_vector1 = geompy.addToStudy(vector1,"Vector1")
id_vector2 = geompy.addToStudy(vector2,"Vector2")
# display the points and the vectors
gg.createAndDisplayGO(id_p1)
gg.createAndDisplayGO(id_p2)
gg.createAndDisplayGO(id_vector1)
gg.createAndDisplayGO(id_vector2)