Salome HOME
Tri dans le repérage des arêtes de peau
[modules/smesh.git] / src / Tools / blocFissure / gmu / toreFissure.py
index 899ef5e0c6abdc12bd0a4fa6e03492e916fd87a4..383ccb05d877e6363c668c0e2e00f11ab487ae49 100644 (file)
@@ -1,14 +1,35 @@
 # -*- coding: utf-8 -*-
 # -*- coding: utf-8 -*-
+# Copyright (C) 2014-2021  EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""tore et plan de fissure"""
 
 import logging
 
 import logging
-from geomsmesh import geompy
 import math
 import math
-from triedreBase import triedreBase
 
 
-O, OX, OY, OZ = triedreBase()
+from .geomsmesh import geompy
+from .geomsmesh import geomPublish
+
+from . import initLog
+
+from .triedreBase import triedreBase
 
 
-# -----------------------------------------------------------------------------
-# --- tore et plan de fissure
+O, OX, OY, OZ = triedreBase()
 
 def toreFissure(minRad,allonge,rayTore):
   """
 
 def toreFissure(minRad,allonge,rayTore):
   """
@@ -17,53 +38,53 @@ def toreFissure(minRad,allonge,rayTore):
   @param minRad :petit rayon
   @param allonge :rapport grand rayon / petit rayon
   @param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
   @param minRad :petit rayon
   @param allonge :rapport grand rayon / petit rayon
   @param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
-  @return (generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part) : ellipse, section du tore,
+  @return (generatrice, face_gen_fiss, pipe, face_fissure, plane, pipe_part) : ellipse, section du tore,
   tore plein, face plane de le fissure, plan de la fissure, tore partitioné par le plan de fissure.
   """
   tore plein, face plane de le fissure, plan de la fissure, tore partitioné par le plan de fissure.
   """
-  logging.info("start ", minRad, allonge, rayTore)
-  
-  Vertex_1 = geompy.MakeVertex( minRad, 0, 0)
-  Vertex_2 = geompy.MakeVertex(-minRad, 0, 0)
-  Vertex_3 = geompy.MakeRotation(Vertex_1, OZ,  45*math.pi/180.0)
-  Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
-  generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1)
-
-  #geompy.addToStudy( Vertex_1, 'Vertex_1' )
-  #geompy.addToStudy( Vertex_2, 'Vertex_2' )
-  #geompy.addToStudy( Vertex_3, 'Vertex_3' )
-  #geompy.addToStudy( Arc_1, 'Arc_1' )
-  #geompy.addToStudy( generatrice, 'generatrice' )
+  logging.info("start %s %s %s", minRad, allonge, rayTore)
+
+  vertex_1 = geompy.MakeVertex( minRad, 0., 0.)
+  vertex_2 = geompy.MakeVertex(-minRad, 0., 0.)
+  vertex_3 = geompy.Makerotation(vertex_1, OZ,  45.*math.pi/180.0)
+  arc = geompy.MakeArc(vertex_1, vertex_2, vertex_3)
+  generatrice = geompy.MakeScaleAlongAxes(arc, O, 1, allonge, 1)
+
+  #geomPublish(initLog.debug,  vertex_1, 'vertex_1' )
+  #geomPublish(initLog.debug,  vertex_2, 'vertex_2' )
+  #geomPublish(initLog.debug,  vertex_3, 'vertex_3' )
+  #geomPublish(initLog.debug,  arc, 'arc' )
+  #geomPublish(initLog.debug,  generatrice, 'generatrice' )
 
   # --- face circulaire sur la generatrice, pour extrusion
 
 
   # --- face circulaire sur la generatrice, pour extrusion
 
-  Circle_1 = geompy.MakeCircle(O, OY, rayTore)
-  Rotation_1 = geompy.MakeRotation(Circle_1, OY, -90*math.pi/180.0)
-  Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0)
-  FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1)
+  circle = geompy.MakeCircle(O, OY, rayTore)
+  rotation = geompy.MakeRotation(circle, OY, -90.*math.pi/180.0)
+  translation = geompy.MakeTranslation(rotation, minRad, 0., 0.)
+  face_gen_fiss = geompy.MakeFaceWires([translation], 1)
 
 
-  #geompy.addToStudy( Circle_1, 'Circle_1' )
-  #geompy.addToStudy( Rotation_1, 'Rotation_1' )
-  #geompy.addToStudy( Translation_1, 'Translation_1' )
-  #geompy.addToStudy( FaceGenFiss, 'FaceGenFiss' )
+  #geomPublish(initLog.debug,  circle, 'circle' )
+  #geomPublish(initLog.debug,  rotation, 'rotation' )
+  #geomPublish(initLog.debug,  translation, 'translation' )
+  #geomPublish(initLog.debug,  face_gen_fiss, 'face_gen_fiss' )
 
   # --- tore extrude
 
 
   # --- tore extrude
 
-  Pipe_1 = geompy.MakePipe(FaceGenFiss, generatrice)
+  pipe = geompy.MakePipe(face_gen_fiss, generatrice)
 
   # --- plan fissure, delimite par la generatrice
 
 
   # --- plan fissure, delimite par la generatrice
 
-  Scale_1_vertex_3 = geompy.GetSubShape(generatrice, [3])
-  Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3)
-  FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1)
+  scale_vertex_3 = geompy.GetSubShape(generatrice, [3])
+  line = geompy.MakeLineTwoPnt(vertex_1, scale_vertex_3)
+  face_fissure = geompy.MakeFaceWires([generatrice, line], 1)
 
 
-  #geompy.addToStudyInFather( generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
-  #geompy.addToStudy( Line_1, 'Line_1' )
-  #geompy.addToStudy( FaceFissure, 'FaceFissure' )
+  #geomPublishInFather(initLog.debug, generatrice, scale_vertex_3, 'scale_1:vertex_3' )
+  #geomPublish(initLog.debug,  line, 'line' )
+  #geomPublish(initLog.debug,  face_fissure, 'face_fissure' )
 
   # --- tore coupe en 2 demi tore de section 1/2 disque
 
 
   # --- tore coupe en 2 demi tore de section 1/2 disque
 
-  Plane_1 = geompy.MakePlane(O, OZ, 2000)
-  Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
-  geompy.addToStudy(Pipe1Part , 'Pipe1Part' )
+  plane = geompy.MakePlane(O, OZ, 2000)
+  pipe_part = geompy.MakePartition([pipe], [plane], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
+  geomPublish(initLog.debug, pipe_part , 'pipe_part' )
 
 
-  return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part
+  return generatrice, face_gen_fiss, pipe, face_fissure, plane, pipe_part