Salome HOME
activateModule/deactivateModule functions are made "bool".
[modules/smesh.git] / src / SMESH_SWIG / ex07_hole1partition.py
1 # CEA/LGLS 2004-2005, Francis KLOSS (OCC)
2 # =======================================
3
4 from geompy import *
5
6 import smesh
7
8 # Geometry
9 # ========
10
11 # A holed cube build by partitioning geometric operations
12
13 # Values
14 # ------
15
16 g_x = 0
17 g_y = 0
18 g_z = 0
19
20 g_longueur = 50.0
21 g_largeur  = 40.0
22 g_hauteur  = 25.0
23
24 g_rayon = 10
25
26 g_trim = 1000
27
28 # Box
29 # ---
30
31 b_boite = MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur,  g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur)
32
33 # Cylinder
34 # --------
35
36 c_axe = MakeVectorDXDYDZ(0, 1, 0)
37
38 c_cyl = MakeCylinder(MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2)
39
40 c_piece = MakeCut(b_boite, c_cyl)
41
42 # Partition and reperation
43 # ------------------------
44
45 p_centre = MakeVertex(g_x, g_y, g_z)
46
47 p_tools = []
48 p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim))
49 p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim))
50
51 p_part = MakePartition([c_piece], p_tools, [], [], ShapeType["SOLID"])
52
53 p_blocs = RemoveExtraEdges(p_part)
54 piece   = MakeGlueFaces(p_blocs, 1.e-5)
55
56 # Add in study
57 # ------------
58
59 piece_id = addToStudy(piece, "ex07_hole1partition")
60
61 # Meshing
62 # =======
63
64 # Create a hexahedral mesh
65 # ------------------------
66
67 hexa = smesh.Mesh(piece, "ex07_hole1partition:hexa")
68
69 algo = hexa.Segment()
70 algo.NumberOfSegments(20)
71
72 hexa.Quadrangle()
73
74 hexa.Hexahedron()
75
76 # Mesh calculus
77 # -------------
78
79 hexa.Compute()