Salome HOME
Merge branch 'master' into gni/evolution
[modules/smesh.git] / src / Tools / blocFissure / materielCasTests / cubeAngle.py
index eb5352a766359ed1ec48daefe8dd751056d5f23b..acecb5fb440c6be632ec2d5aeeb87e73d8c42dfa 100644 (file)
@@ -1,12 +1,30 @@
 # -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020  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
+#
+
+import logging
 
 import sys
 import salome
 
 salome.salome_init()
 
-import salome_notebook
-
 import os
 from blocFissure import gmu
 
@@ -33,7 +51,7 @@ Vertex_2 = geompy.MakeVertex(-5, -5, 90)
 Vertex_3 = geompy.MakeVertex(65, 65, 110)
 Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
 Common_1 = geompy.MakeCommon(Disk_1, Box_2)
-geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"))
+geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngleFiss.brep"))
 geompy.addToStudy( O, 'O' )
 geompy.addToStudy( OX, 'OX' )
 geompy.addToStudy( OY, 'OY' )
@@ -56,14 +74,23 @@ from salome.smesh import smeshBuilder
 smesh = smeshBuilder.New()
 from salome.StdMeshers import StdMeshersBuilder
 Mesh_1 = smesh.Mesh(Box_1)
+smesh.SetName(Mesh_1, 'Mesh_1')
 Regular_1D = Mesh_1.Segment()
 Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
 Nb_Segments_1.SetDistrType( 0 )
 Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
 Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa)
-isDone = Mesh_1.Compute()
-smesh.SetName(Mesh_1, 'Mesh_1')
-Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/CubeAngle.med"))
+
+is_done = Mesh_1.Compute()
+text = "Mesh_1.Compute"
+if is_done:
+  logging.info(text+" OK")
+else:
+  text = "Erreur au calcul du maillage.\n" + text
+  logging.info(text)
+  raise Exception(text)
+
+Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med"))
 
 ## set object names
 smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')