Salome HOME
Merge branch 'master' into V9_dev
[modules/geom.git] / doc / salome / examples / basic_operations_ex01.py
1 # Partition
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
8 gg = salome.ImportComponentGUI("GEOM")
9
10 # create a vertex and a vector
11 p0   = geompy.MakeVertex(  0.,   0.,   0.)
12 p200 = geompy.MakeVertex(200., 200., 200.)
13 pz   = geompy.MakeVertex(  0.,   0., 100.)
14
15 # create a vector
16 vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.)
17
18 # create a box from two points
19 box = geompy.MakeBoxTwoPnt(p0, p200)
20
21 # create a plane
22 trimsize  = 500.
23 plane = geompy.MakePlane(pz, vxyz, trimsize)
24
25 # create partition
26 partition = geompy.MakePartition([box], [plane])
27
28 # add objects in the study
29 id_box = geompy.addToStudy(box,"Box")
30 id_plane = geompy.addToStudy(plane,"Plane")
31 id_partition = geompy.addToStudy(partition,"Partition")
32
33 # display the partition objects and the plane
34 gg.createAndDisplayGO(id_box)
35 gg.setDisplayMode(id_box,1)
36 gg.createAndDisplayGO(id_plane)
37 gg.setDisplayMode(id_plane,1)
38 gg.createAndDisplayGO(id_partition)