1 # CEA/LGLS 2004-2005, Francis KLOSS (OCC)
2 # =======================================
11 # A not centered holed cube build by boolean geometric operations
33 def triangle(p1, p2, p3):
35 l.append(MakeEdge(p1, p2))
36 l.append(MakeEdge(p2, p3))
37 l.append(MakeEdge(p3, p1))
44 basePoint111 = MakeVertex(ox-longueur1, oy, oz-largeur1)
45 basePoint211 = MakeVertex(ox+longueur2, oy, oz-largeur1)
46 basePoint112 = MakeVertex(ox-longueur1, oy, oz+largeur2)
47 basePoint212 = MakeVertex(ox+longueur2, oy, oz+largeur2)
49 holePoint = MakeVertex(ox, oy, oz)
54 baseFace1 = triangle(basePoint111, basePoint211, holePoint)
55 baseFace2 = triangle(basePoint211, basePoint212, holePoint)
56 baseFace3 = triangle(basePoint212, basePoint112, holePoint)
57 baseFace4 = triangle(basePoint112, basePoint111, holePoint)
62 baseVector = MakeVectorDXDYDZ(0, 1, 0)
64 baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur)
65 baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur)
66 baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur)
67 baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur)
69 holeSolid = MakeCylinder(holePoint, baseVector, rayon, hauteur)
74 baseHexa1 = MakeCut(baseSolid1, holeSolid)
75 baseHexa2 = MakeCut(baseSolid2, holeSolid)
76 baseHexa3 = MakeCut(baseSolid3, holeSolid)
77 baseHexa4 = MakeCut(baseSolid4, holeSolid)
79 # Compound, glue and repair
80 # -------------------------
88 c_cpd = MakeCompound(c_l)
89 c_glu = MakeGlueFaces(c_cpd, 1.e-5)
90 piece = RemoveExtraEdges(c_glu)
95 piece_id = addToStudy(piece, "ex06_hole1boolean")
100 # Create a hexahedral mesh
101 # ------------------------
103 hexa = smesh.Mesh(piece, "ex06_hole1boolean:hexa")
105 algo = hexa.Segment()
107 algo.NumberOfSegments(11)
113 # Create local hypothesis
114 # -----------------------
116 edge1 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz-largeur1))
117 algo1 = hexa.Segment(edge1)
118 algo1.NumberOfSegments(3)
121 edge2 = GetEdgeNearPoint(piece, MakeVertex(ox-longueur1, oy, oz))
122 algo2 = hexa.Segment(edge2)
123 algo2.NumberOfSegments(5)
126 edge3 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz+largeur2))
127 algo3 = hexa.Segment(edge3)
128 algo3.NumberOfSegments(7)
131 edge4 = GetEdgeNearPoint(piece, MakeVertex(ox+longueur2, oy, oz))
132 algo4 = hexa.Segment(edge4)
133 algo4.NumberOfSegments(9)