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