X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2FmaterielCasTests%2FcubeFin.py;h=69ecdb8134c1e573bcd7fdaaf64d2acaf129c03e;hp=6f9129bfe2947ba84dfec26a053f52b332599870;hb=850c52d788f58c43293546de2494826352c0cc19;hpb=0c5188fd2cf587b6c74c6adce920158f7edd4419 diff --git a/src/Tools/blocFissure/materielCasTests/cubeFin.py b/src/Tools/blocFissure/materielCasTests/cubeFin.py index 6f9129bfe..69ecdb813 100644 --- a/src/Tools/blocFissure/materielCasTests/cubeFin.py +++ b/src/Tools/blocFissure/materielCasTests/cubeFin.py @@ -1,13 +1,31 @@ # -*- 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() -theStudy = salome.myStudy import salome_notebook -notebook = salome_notebook.NoteBook(theStudy) import os from blocFissure import gmu @@ -22,7 +40,7 @@ import math import SALOMEDS -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() O = geompy.MakeVertex(0, 0, 0) OX = geompy.MakeVectorDXDYDZ(1, 0, 0) @@ -93,9 +111,9 @@ geompy.addToStudy( O_1, 'O' ) geompy.addToStudy( OX_1, 'OX' ) geompy.addToStudy( OY_1, 'OY' ) geompy.addToStudy( OZ_1, 'OZ' ) -geompy.Export(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"), "BREP") -geompy.Export(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"), "BREP") -geompy.Export(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"), "BREP") +geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Transverse.brep")) +geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Coin.brep")) +geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Milieu.brep")) ### ### SMESH component @@ -104,17 +122,23 @@ geompy.Export(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests/cubeF import SMESH, SALOMEDS from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() cubeFin_1 = smesh.Mesh(cubeFin) Regular_1D = cubeFin_1.Segment() Nb_Segments_1 = Regular_1D.NumberOfSegments(20) Nb_Segments_1.SetDistrType( 0 ) Quadrangle_2D = cubeFin_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) Hexa_3D = cubeFin_1.Hexahedron(algo=smeshBuilder.Hexa) -isDone = cubeFin_1.Compute() DEPL_1 = cubeFin_1.GroupOnGeom(DEPL,'DEPL',SMESH.FACE) ENCASTR_1 = cubeFin_1.GroupOnGeom(ENCASTR,'ENCASTR',SMESH.FACE) - +is_done = cubeFin_1.Compute() +text = "cubeFin_1.Compute" +if is_done: + logging.info(text+" OK") +else: + text = "Erreur au calcul du maillage.\n" + text + logging.info(text) + raise Exception(text) ## Set names of Mesh objects smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') @@ -124,7 +148,7 @@ smesh.SetName(ENCASTR_1, 'ENCASTR') smesh.SetName(cubeFin_1.GetMesh(), 'cubeFin') smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') -cubeFin_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/cubeFin.med"), 0, SMESH.MED_V2_2, 1 ) +cubeFin_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med")) if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) + salome.sg.updateObjBrowser()