1 # CEA/LGLS 2004-2005, Francis KLOSS (OCC)
2 # =======================================
11 # Construire avec des hexahedres une piece faite de 2 cylindres de diametre different
12 # et dont les axes se coupent orthogonalement, puis mailler.
34 g_base = MakeVertex(cx, cy, cz)
35 g_dir = MakeVectorDXDYDZ(0, 0, 1)
36 t_hauteur = p_rayon+10.0
38 g_cyl = MakeCylinder(g_base, g_dir, g_rayon, g_hauteur)
40 g_coupe = MakeVectorDXDYDZ(1, 0, 0)
43 g_tools.append(MakePlane(MakeVertex(cx+t_hauteur, cy, cz), g_coupe, g_trim))
44 g_tools.append(MakePlane(MakeVertex(cx-t_hauteur, cy, cz), g_coupe, g_trim))
46 g_partie = MakePartition([g_cyl], g_tools, [], [], ShapeType["SOLID"])
47 g_bas, g_centre, g_haut = SubShapeAllSorted(g_partie, ShapeType["SOLID"])
49 # Partie basse du gros cylindre
50 # -----------------------------
55 b_boite = MakeBox(cx-t_hauteur, cy-b_base, cz, cx-t_hauteur-b_hauteur, cy+b_base, cz+g_hauteur)
58 b_cyl = MakeCut(g_bas, b_boite)
61 b_tools.append(MakePlane(MakeVertex(cx-t_hauteur-b_hauteur, cy+b_base, cz), MakeVectorDXDYDZ( 1, 1, 0), g_trim))
62 b_tools.append(MakePlane(MakeVertex(cx-t_hauteur-b_hauteur, cy-b_base, cz), MakeVectorDXDYDZ(-1, 1, 0), g_trim))
64 b_partie = MakePartition([b_cyl], b_tools, [], [], ShapeType["SOLID"])
65 b_element = SubShapeAll(b_partie, ShapeType["SOLID"])
68 # Partie haute du gros cylindre
69 # -----------------------------
71 h_plan = MakePlane(g_base, g_coupe, g_trim)
73 cpd.append(MakeMirrorByPlane(b_boite, h_plan))
76 h_symetrie = MakeMirrorByPlane(h, h_plan)
77 cpd.append(h_symetrie)
83 x_arete = z_arete*t_hauteur*2/g_hauteur
89 p_base = MakeVertex(cx, py, pz)
90 p_dir = MakeVectorDXDYDZ(0, 1, 0)
91 p_cyl = MakeCylinder(p_base, p_dir, p_rayon, p_hauteur)
93 p_boite = MakeBox(px, py, pz-z_arete, cx+x_arete, py+p_hauteur, pz+z_arete)
95 # Partie interieure du petit cylindre
96 # -----------------------------------
98 i_cyl = MakeCommon(p_cyl, g_cyl)
99 i_tuyau = MakeCut(i_cyl, p_boite)
100 i_boite = MakeCommon(p_boite, g_cyl)
102 # Partie exterieure du petit cylindre
103 # -----------------------------------
105 e_cyl0 = MakeCut(p_cyl, g_cyl)
106 e_cyl = SubShapeAllSorted(e_cyl0, ShapeType["SOLID"])
108 e_tuyau = MakeCut(e_cyl[1], p_boite)
110 e_boite0 = MakeCut(p_boite, g_cyl)
111 e_boite = SubShapeAllSorted(e_boite0, ShapeType["SOLID"])
113 cpd.append(e_boite[1])
115 # Partie centrale du gros cylindre
116 # --------------------------------
118 c_cyl = MakeCut(g_centre, p_cyl)
124 p_tools.append(MakePlane(MakeVertex(px, py, pz-z_arete), MakeVectorDXDYDZ(-z_arete, 0, x_arete), g_trim))
125 p_tools.append(MakePlane(MakeVertex(px, py, pz+z_arete), MakeVectorDXDYDZ( z_arete, 0, x_arete), g_trim))
127 p_partie = MakePartition([e_tuyau], p_tools, [], [], ShapeType["SOLID"])
128 p_element = SubShapeAll(p_partie, ShapeType["SOLID"])
129 cpd = cpd + p_element
131 q_partie = MakePartition([i_tuyau, c_cyl], p_tools, [], [], ShapeType["SOLID"])
132 q_element = SubShapeAll(q_partie, ShapeType["SOLID"])
134 q_element = q_element + [i_boite]
137 q_tools.append(MakePlane(MakeVertex(cx, cy-b_base, cz), MakeVectorDXDYDZ(0, 1, 0), g_trim))
138 q_tools.append(MakePlane(MakeVertex(cx, cy+b_base, cz), MakeVectorDXDYDZ(0, 1, 0), g_trim))
142 r_partie = MakePartition([e], q_tools, [], [], ShapeType["SOLID"])
143 r_element = r_element + SubShapeAll(r_partie, ShapeType["SOLID"])
145 cpd = cpd + r_element
150 piece = RemoveExtraEdges(MakeCompound(cpd))
152 # Ajouter la piece dans l'etude
153 # -----------------------------
155 piece_id = addToStudy(piece, "ex15_cyl2geometry")
160 # Create a hexahedral mesh
161 # ------------------------
163 hexa = smesh.Mesh(piece, "ex15_cyl2geometry:hexa")
165 algo = hexa.Segment()
166 algo.NumberOfSegments(12)