Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Building by Blocks


Quadrangle Face

1 # Quadrangle Face
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 p1 = geompy.MakeVertex( 0., 0., 0.)
12 p2 = geompy.MakeVertex(150., 30., 0.)
13 p3 = geompy.MakeVertex( 0., 120., 50.)
14 p4 = geompy.MakeVertex( 0., 40., 70.)
15 
16 # create edges
17 edge1 = geompy.MakeEdge(p1, p2)
18 edge2 = geompy.MakeEdge(p2, p3)
19 edge3 = geompy.MakeEdge(p3, p4)
20 edge4 = geompy.MakeEdge(p4, p1)
21 
22 # create a quadrangle face from four edges
23 qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
24 
25 # create a quadrangle face from two edges
26 qface2 = geompy.MakeQuad2Edges(edge1, edge3)
27 
28 # create a quadrangle from four points in its corners
29 qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
30 
31 # add objects in the study
32 id_p1 = geompy.addToStudy(p1,"Point1")
33 id_p2 = geompy.addToStudy(p2,"Point2")
34 id_p3 = geompy.addToStudy(p3,"Point3")
35 id_p4 = geompy.addToStudy(p4,"Point4")
36 id_edge1 = geompy.addToStudy(edge1,"Edge1")
37 id_edge2 = geompy.addToStudy(edge2,"Edge2")
38 id_edge3 = geompy.addToStudy(edge3,"Edge3")
39 id_edge4 = geompy.addToStudy(edge4,"Edge4")
40 id_qface1 = geompy.addToStudy(qface1,"Qface1")
41 id_qface2 = geompy.addToStudy(qface2,"Qface2")
42 id_qface3 = geompy.addToStudy(qface3,"Qface3")
43 
44 # display the vertices, the edges and the quadrangle faces
45 gg.createAndDisplayGO(id_p1)
46 gg.createAndDisplayGO(id_p2)
47 gg.createAndDisplayGO(id_p3)
48 gg.createAndDisplayGO(id_p4)
49 gg.createAndDisplayGO(id_edge1)
50 gg.createAndDisplayGO(id_edge2)
51 gg.createAndDisplayGO(id_edge3)
52 gg.createAndDisplayGO(id_edge4)
53 gg.createAndDisplayGO(id_qface1)
54 gg.setDisplayMode(id_qface1,1)
55 gg.createAndDisplayGO(id_qface2)
56 gg.setDisplayMode(id_qface2,1)
57 gg.createAndDisplayGO(id_qface3)
58 gg.setDisplayMode(id_qface3,1)

Download this script


Hexagonal Solid

1 # Hexagonal Solid
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 p1 = geompy.MakeVertex( 0., 0., 40.)
13 p2 = geompy.MakeVertex( 70., -15., 0.)
14 p3 = geompy.MakeVertex( 70., -15., 70.)
15 
16 p4 = geompy.MakeVertex( 0., 70., 0.)
17 p5 = geompy.MakeVertex( 0., 70., 40.)
18 p6 = geompy.MakeVertex( 70., 70., 0.)
19 p7 = geompy.MakeVertex( 70., 70., 70.)
20 
21 p8 = geompy.MakeVertex( 0., -50., 0.)
22 p9 = geompy.MakeVertex( 0., -50., 40.)
23 p10 = geompy.MakeVertex( 70., -35., 0.)
24 p11 = geompy.MakeVertex( 70., -35., 70.)
25 
26 # create faces
27 qface1 = geompy.MakeQuad4Vertices(p0, p1, p2, p3)
28 qface2 = geompy.MakeQuad4Vertices(p4, p5, p6, p7)
29 qface3 = geompy.MakeQuad4Vertices(p0, p1, p4, p5)
30 qface4 = geompy.MakeQuad4Vertices(p2, p3, p6, p7)
31 qface5 = geompy.MakeQuad4Vertices(p0, p2, p4, p6)
32 qface6 = geompy.MakeQuad4Vertices(p1, p3, p5, p7)
33 qface7 = geompy.MakeQuad4Vertices(p8, p9, p10, p11)
34 
35 # create a hexahedral solid between two given faces
36 solid1 = geompy.MakeHexa2Faces(qface1, qface7)
37 
38 # create a hexahedral solid, bounded by six given faces
39 solid2 = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
40 
41 # add objects in the study
42 geompy.addToStudy(qface1,"qface1")
43 geompy.addToStudy(qface2,"qface2")
44 geompy.addToStudy(qface3,"qface3")
45 geompy.addToStudy(qface4,"qface4")
46 geompy.addToStudy(qface5,"qface5")
47 geompy.addToStudy(qface6,"qface6")
48 geompy.addToStudy(qface7,"qface7")
49 
50 id_solid1 = geompy.addToStudy(solid1,"Solid1")
51 id_solid2 = geompy.addToStudy(solid2,"Solid2")
52 
53 # display solids
54 gg.createAndDisplayGO(id_solid1)
55 gg.setDisplayMode(id_solid1, 1)
56 gg.createAndDisplayGO(id_solid2)
57 gg.setDisplayMode(id_solid2, 1)

Download this script