Salome HOME
793ef68d582bb7e9f0686cde68c56f858f43c389
[modules/smesh.git] / src / Tools / blocFissure / gmu / toreFissure.py
1 # -*- coding: utf-8 -*-
2
3 import logging
4 from .geomsmesh import geompy
5 from .geomsmesh import geomPublish
6 from .geomsmesh import geomPublishInFather
7 from . import initLog
8 import math
9 from .triedreBase import triedreBase
10
11 O, OX, OY, OZ = triedreBase()
12
13 # -----------------------------------------------------------------------------
14 # --- tore et plan de fissure
15
16 def toreFissure(minRad,allonge,rayTore):
17   """
18   Construction de la geometrie du tore elliptique autour du front de fissure.
19   L'ellipse est construite dans le plan xoy, axe oy.
20   @param minRad :petit rayon
21   @param allonge :rapport grand rayon / petit rayon
22   @param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
23   @return (generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part) : ellipse, section du tore,
24   tore plein, face plane de le fissure, plan de la fissure, tore partitione par le plan de fissure.
25   """
26   logging.info("start ", minRad, allonge, rayTore)
27   
28   Vertex_1 = geompy.MakeVertex( minRad, 0, 0)
29   Vertex_2 = geompy.MakeVertex(-minRad, 0, 0)
30   Vertex_3 = geompy.MakeRotation(Vertex_1, OZ,  45*math.pi/180.0)
31   Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
32   generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1)
33
34   #geomPublish(initLog.debug,  Vertex_1, 'Vertex_1' )
35   #geomPublish(initLog.debug,  Vertex_2, 'Vertex_2' )
36   #geomPublish(initLog.debug,  Vertex_3, 'Vertex_3' )
37   #geomPublish(initLog.debug,  Arc_1, 'Arc_1' )
38   #geomPublish(initLog.debug,  generatrice, 'generatrice' )
39
40   # --- face circulaire sur la generatrice, pour extrusion
41
42   Circle_1 = geompy.MakeCircle(O, OY, rayTore)
43   Rotation_1 = geompy.MakeRotation(Circle_1, OY, -90*math.pi/180.0)
44   Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0)
45   FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1)
46
47   #geomPublish(initLog.debug,  Circle_1, 'Circle_1' )
48   #geomPublish(initLog.debug,  Rotation_1, 'Rotation_1' )
49   #geomPublish(initLog.debug,  Translation_1, 'Translation_1' )
50   #geomPublish(initLog.debug,  FaceGenFiss, 'FaceGenFiss' )
51
52   # --- tore extrude
53
54   Pipe_1 = geompy.MakePipe(FaceGenFiss, generatrice)
55
56   # --- plan fissure, delimite par la generatrice
57
58   Scale_1_vertex_3 = geompy.GetSubShape(generatrice, [3])
59   Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3)
60   FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1)
61
62   #geomPublishInFather(initLog.debug, generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
63   #geomPublish(initLog.debug,  Line_1, 'Line_1' )
64   #geomPublish(initLog.debug,  FaceFissure, 'FaceFissure' )
65
66   # --- tore coupe en 2 demi tore de section 1/2 disque
67
68   Plane_1 = geompy.MakePlane(O, OZ, 2000)
69   Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
70   geomPublish(initLog.debug, Pipe1Part , 'Pipe1Part' )
71
72   return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part