Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/geom.git] / doc / salome / examples / transformation_operations_ex03.py
1 # Modify Location
2
3 import geompy
4 import salome
5 import math
6 gg = salome.ImportComponentGUI("GEOM")
7
8 # create a vertex and a vector
9 p1 = geompy.MakeVertex(10, 40, 0)
10 p2 = geompy.MakeVertex( 0,  0, 50)
11 v = geompy.MakeVector(p1, p2)
12
13 # create a cylinder
14 height = 35
15 radius1 = 20
16 cylinder = geompy.MakeCylinder(p1, v, radius1, height)
17 circle   = geompy.MakeCircle(p2, v, radius1)
18
19 # create local coordinate systems
20 cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
21 cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
22
23 # modify the location of the given object
24 position = geompy.MakePosition(cylinder, cs1, cs2)
25 position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
26
27 # add objects in the study
28 id_cs1 = geompy.addToStudy(cs1, "Coordinate system 1")
29 id_cs2 = geompy.addToStudy(cs2, "Coordinate system 2")
30 id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
31 id_circle = geompy.addToStudy(circle, "Circle")
32 id_position = geompy.addToStudy(position, "Position")
33 id_position2 = geompy.addToStudy(position2, "PositionAlongPath")
34
35 # display the results
36 gg.createAndDisplayGO(id_cylinder)
37 gg.setDisplayMode(id_cylinder,1)
38 gg.createAndDisplayGO(id_position)
39 gg.setDisplayMode(id_position,1)
40 gg.createAndDisplayGO(id_circle)
41 gg.setDisplayMode(id_circle,1)
42 gg.createAndDisplayGO(id_position2)
43 gg.setDisplayMode(id_position2,1)