Salome HOME
Fix wrong comments indentation
[modules/smesh.git] / src / SMESH_SWIG / cube2partition.py
1 # CEA/LGLS 2004, Francis KLOSS (OCC)
2 # ==================================
3
4 # Import
5 # ------
6
7 from geompy import *
8 from meshpy import *
9
10 # Piece
11 # -----
12
13 # A small cube centered and put on a great cube
14
15 # Geometry
16 # --------
17
18 g_ox = 0
19 g_oy = 0
20 g_oz = 0
21
22 g_arete = 10
23
24 g_trim = 1000
25
26 # Points
27 # ------
28
29 v_arete2 = g_arete*2
30 v_arete3 = g_arete*3
31
32 v_1 = MakeVertex(g_ox         , g_oy         , g_oz         )
33 v_2 = MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3)
34
35 v_3 = MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete )
36 v_4 = MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2)
37
38 # Solids
39 # ------
40
41 s_base = MakeBoxTwoPnt(v_1, v_2)
42 s_haut = MakeBoxTwoPnt(v_3, v_4)
43
44 # Partition
45 # ---------
46
47 p_dir1 = MakeVectorDXDYDZ(1, 0, 0)
48 p_dir2 = MakeVectorDXDYDZ(0, 0, 1)
49
50 p_tools = []
51 p_tools.append(MakePlane(v_3, p_dir1, g_trim))
52 p_tools.append(MakePlane(v_4, p_dir1, g_trim))
53 p_tools.append(MakePlane(v_3, p_dir2, g_trim))
54 p_tools.append(MakePlane(v_4, p_dir2, g_trim))
55
56 p_element = MakePartition([s_base], p_tools, [], [], ShapeType["SOLID"])
57
58 # Compound
59 # --------
60
61 c_element = SubShapeAll(p_element, ShapeType["SOLID"])
62 c_element.append(s_haut)
63
64 c_cpd = MakeCompound(c_element)
65 piece = MakeGlueFaces(c_cpd, 1.e-5)
66
67 # Study
68 # -----
69
70 piece_id = addToStudy(piece, "Cubes2partition")
71
72 # Meshing
73 # =======
74
75 # Create hexahedrical mesh on piece
76 # ---------------------------------
77
78 m_hexa=MeshHexa(piece, 4, "Cubes2partitionHexa")
79
80 # Compute
81 # -------
82
83 m_hexa.Compute()