1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 from .geomsmesh import geompy
23 from .geomsmesh import geomPublish
24 from .geomsmesh import geomPublishInFather
27 from .triedreBase import triedreBase
29 O, OX, OY, OZ = triedreBase()
31 # -----------------------------------------------------------------------------
32 # --- tore et plan de fissure
34 def toreFissure(minRad,allonge,rayTore):
36 Construction de la geometrie du tore elliptique autour du front de fissure.
37 L'ellipse est construite dans le plan xoy, axe oy.
38 @param minRad :petit rayon
39 @param allonge :rapport grand rayon / petit rayon
40 @param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
41 @return (generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part) : ellipse, section du tore,
42 tore plein, face plane de le fissure, plan de la fissure, tore partitioné par le plan de fissure.
44 logging.info("start ", minRad, allonge, rayTore)
46 Vertex_1 = geompy.MakeVertex( minRad, 0, 0)
47 Vertex_2 = geompy.MakeVertex(-minRad, 0, 0)
48 Vertex_3 = geompy.MakeRotation(Vertex_1, OZ, 45*math.pi/180.0)
49 Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
50 generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1)
52 #geomPublish(initLog.debug, Vertex_1, 'Vertex_1' )
53 #geomPublish(initLog.debug, Vertex_2, 'Vertex_2' )
54 #geomPublish(initLog.debug, Vertex_3, 'Vertex_3' )
55 #geomPublish(initLog.debug, Arc_1, 'Arc_1' )
56 #geomPublish(initLog.debug, generatrice, 'generatrice' )
58 # --- face circulaire sur la generatrice, pour extrusion
60 Circle_1 = geompy.MakeCircle(O, OY, rayTore)
61 Rotation_1 = geompy.MakeRotation(Circle_1, OY, -90*math.pi/180.0)
62 Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0)
63 FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1)
65 #geomPublish(initLog.debug, Circle_1, 'Circle_1' )
66 #geomPublish(initLog.debug, Rotation_1, 'Rotation_1' )
67 #geomPublish(initLog.debug, Translation_1, 'Translation_1' )
68 #geomPublish(initLog.debug, FaceGenFiss, 'FaceGenFiss' )
72 Pipe_1 = geompy.MakePipe(FaceGenFiss, generatrice)
74 # --- plan fissure, delimite par la generatrice
76 Scale_1_vertex_3 = geompy.GetSubShape(generatrice, [3])
77 Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3)
78 FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1)
80 #geomPublishInFather(initLog.debug, generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
81 #geomPublish(initLog.debug, Line_1, 'Line_1' )
82 #geomPublish(initLog.debug, FaceFissure, 'FaceFissure' )
84 # --- tore coupe en 2 demi tore de section 1/2 disque
86 Plane_1 = geompy.MakePlane(O, OZ, 2000)
87 Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
88 geomPublish(initLog.debug, Pipe1Part , 'Pipe1Part' )
90 return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part