]> SALOME platform Git repositories - modules/geom.git/blob - doc/salome/examples/topological_geom_objs_ex04.py
Salome HOME
Revert "Synchronize adm files"
[modules/geom.git] / doc / salome / examples / topological_geom_objs_ex04.py
1 # Creation of a Shell
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI("GEOM")
9
10 #create vertices
11 p0   = geompy.MakeVertex( 0.,  0.,  0.)
12 pxyz = geompy.MakeVertex( 5.,  5., 40.)
13
14 # create sketchers
15 sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
16 sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
17 isPlanarFace = 1
18
19 # create a face from two wires
20 face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace)
21
22 # create a prism
23 prism = geompy.MakePrism(face, p0, pxyz)
24
25 # explode the prism into faces
26 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
27
28 # create a shell from a set of faces
29 shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3],
30                           prism_faces[7], prism_faces[9]])
31
32 # add objects in the study
33 id_shell = geompy.addToStudy(shell,"Shell")
34
35 # display the shell
36 gg.createAndDisplayGO(id_shell)
37 gg.setDisplayMode(id_shell,1)