1 # CEA/LGLS 2005, Francis KLOSS (OCC)
2 # ==================================
11 # Mailler en hexahedre une sphere dans un cube.
25 sphere_centre = MakeVertex(0, 0, 0)
27 sphere_pleine = MakeSpherePntR(sphere_centre, sphere_rayon)
32 boite_cote = sphere_rayon / 2
34 boite = MakeBox(-boite_cote, -boite_cote, -boite_cote, +boite_cote, +boite_cote, +boite_cote)
41 sphere_troue = MakeCut(sphere_pleine, boite)
44 sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 0, 1), plan_trim))
45 sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 0, -1), plan_trim))
46 sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 1, 0), plan_trim))
47 sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ(-1, 1, 0), plan_trim))
49 sphere_decoupee = MakePartition([sphere_troue], sphere_outils, [], [], ShapeType["SOLID"])
51 sphere_partie = GetBlockNearPoint(sphere_decoupee, MakeVertex(-sphere_rayon, 0, 0))
52 sphere_bloc = RemoveExtraEdges(sphere_partie)
54 blocs.append(sphere_bloc)
58 sphere_dir1 = MakeVectorDXDYDZ(0, 1, 0)
59 sphere_dir2 = MakeVectorDXDYDZ(0, 0, 1)
61 blocs.append(MakeRotation(sphere_bloc, sphere_dir1, +pi2))
62 blocs.append(MakeRotation(sphere_bloc, sphere_dir1, -pi2))
64 blocs.append(MakeRotation(sphere_bloc, sphere_dir2, +pi2))
65 blocs.append(MakeRotation(sphere_bloc, sphere_dir2, -pi2))
67 blocs.append(MakeMirrorByPoint(sphere_bloc, sphere_centre))
72 cube_plein = MakeBox(-cube_cote, -cube_cote, -cube_cote, +cube_cote, +cube_cote, +cube_cote)
73 cube_trou = MakeCut(cube_plein, sphere_pleine)
74 cube_decoupe = MakePartition([cube_trou], sphere_outils, [], [], ShapeType["SOLID"])
75 cube_partie = GetBlockNearPoint(cube_decoupe, MakeVertex(-cube_cote, 0, 0))
76 cube_bloc = RemoveExtraEdges(cube_partie)
78 blocs.append(cube_bloc)
80 blocs.append(MakeRotation(cube_bloc, sphere_dir1, +pi2))
81 blocs.append(MakeRotation(cube_bloc, sphere_dir1, -pi2))
83 blocs.append(MakeRotation(cube_bloc, sphere_dir2, +pi2))
84 blocs.append(MakeRotation(cube_bloc, sphere_dir2, -pi2))
86 blocs.append(MakeMirrorByPoint(cube_bloc, sphere_centre))
91 piece_cpd = MakeCompound(blocs)
92 piece = MakeGlueFaces(piece_cpd, 1.e-3)
94 piece_id = addToStudy(piece, "ex19_sphereINcube")
99 # Definition du groupe
100 # --------------------
102 groupe = CreateGroup(piece, ShapeType["SOLID"])
104 groupe_nom = "ex19_sphereINcube_interieur"
105 addToStudy(groupe, groupe_nom)
106 groupe.SetName(groupe_nom)
111 groupe_sphere = GetShapesOnSphere(piece, ShapeType["SOLID"], sphere_centre, sphere_rayon, GEOM.ST_ONIN)
113 UnionList(groupe, groupe_sphere)
118 # Create a hexahedral mesh
119 # ------------------------
121 hexa = smesh.Mesh(piece, "ex19_sphereINcube:hexa")
123 algo = hexa.Segment()
124 algo.NumberOfSegments(10)
135 # Le groupe de mailles
136 # --------------------
138 hexa_groupe = hexa.Group(groupe)