X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2FblocFissure%2FmaterielCasTests%2Fdisque_perce.py;h=0bc931a2339228a44b8bf6520e584e5a3571b619;hb=8f0082e9d096c07207e1bf9d68488c195abf515a;hp=316fb0701c619f092c444594e52fa9347f471f79;hpb=d3e1cabf77f67408ac401e2d387e721605cb3b10;p=modules%2Fsmesh.git diff --git a/src/Tools/blocFissure/materielCasTests/disque_perce.py b/src/Tools/blocFissure/materielCasTests/disque_perce.py index 316fb0701..0bc931a23 100644 --- a/src/Tools/blocFissure/materielCasTests/disque_perce.py +++ b/src/Tools/blocFissure/materielCasTests/disque_perce.py @@ -1,63 +1,77 @@ # -*- coding: iso-8859-1 -*- +# 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 +# +"""Géométrie et maillage de base nécessaire au cas-test : +. disque_perce +""" -import sys -import salome +import os -salome.salome_init() +import logging -import salome_notebook -notebook = salome_notebook.notebook +import salome +from salome.smesh import smeshBuilder +from salome.StdMeshers import StdMeshersBuilder +import GEOM +import SMESH +import SALOMEDS -import os from blocFissure import gmu +from blocFissure.gmu.geomsmesh import geompy +from blocFissure.gmu.geomsmesh import geomPublish +from blocFissure.gmu.geomsmesh import geomPublishInFather +from blocFissure.gmu.triedreBase import triedreBase +from blocFissure.gmu.putName import putName +from blocFissure.gmu import initLog ### ### GEOM component ### -import GEOM -from salome.geom import geomBuilder -import math -import SALOMEDS +O, OX, OY, OZ = triedreBase() - -geompy = geomBuilder.New() - -O = geompy.MakeVertex(0, 0, 0) -OX = geompy.MakeVectorDXDYDZ(1, 0, 0) -OY = geompy.MakeVectorDXDYDZ(0, 1, 0) -OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) Cylinder_1 = geompy.MakeCylinderRH(100, 300) Cylinder_2 = geompy.MakeCylinderRH(600, 200) Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1) Face_1 = geompy.MakeFaceHW(500, 1500, 3) Disque = geompy.MakePartition([Cut_1], [Face_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) [Compound_1, Compound_2, Compound_3, Compound_4] = geompy.Propagate(Disque) -geompy.addToStudy( O, 'O' ) -geompy.addToStudy( OX, 'OX' ) -geompy.addToStudy( OY, 'OY' ) -geompy.addToStudy( OZ, 'OZ' ) -geompy.addToStudy( Cylinder_1, 'Cylinder_1' ) -geompy.addToStudy( Cylinder_2, 'Cylinder_2' ) -geompy.addToStudy( Cut_1, 'Cut_1' ) -geompy.addToStudy( Face_1, 'Face_1' ) geompy.addToStudy( Disque, 'Disque' ) geompy.addToStudyInFather( Disque, Compound_1, 'Compound_1' ) geompy.addToStudyInFather( Disque, Compound_2, 'Compound_2' ) geompy.addToStudyInFather( Disque, Compound_3, 'Compound_3' ) geompy.addToStudyInFather( Disque, Compound_4, 'Compound_4' ) +geomPublish(initLog.debug, Cylinder_1, 'Cylinder_1' ) +geomPublish(initLog.debug, Cylinder_2, 'Cylinder_2' ) +geomPublish(initLog.debug, Cut_1, 'Cut_1' ) +geomPublish(initLog.debug, Face_1, 'Face_1' ) + ### ### SMESH component ### -import SMESH, SALOMEDS -from salome.smesh import smeshBuilder - smesh = smeshBuilder.New() -from salome.StdMeshers import StdMeshersBuilder Disque_1 = smesh.Mesh(Disque) +putName(Disque_1.GetMesh(), 'Disque') + Regular_1D = Disque_1.Segment() Nb_Segments_1 = Regular_1D.NumberOfSegments(10) Nb_Segments_1.SetDistrType( 0 ) @@ -68,21 +82,24 @@ Nb_Segments_2.SetDistrType( 0 ) Regular_1D_2 = Disque_1.Segment(geom=Compound_4) status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4) Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) -isDone = Disque_1.Compute() -smesh.SetName(Disque_1, 'Disque') -Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/disque.med")) -SubMesh_1 = Regular_1D_1.GetSubMesh() -SubMesh_2 = Regular_1D_2.GetSubMesh() ## set object names -smesh.SetName(Disque_1.GetMesh(), 'Disque') -smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') -smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') -smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') -smesh.SetName(Nb_Segments_2, 'Nb. Segments_2') -smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') -smesh.SetName(SubMesh_1, 'SubMesh_1') -smesh.SetName(SubMesh_2, 'SubMesh_2') +#smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +#smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +#smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') +putName(Nb_Segments_1, 'Nb. Segments_1', i_pref='Disque') +putName(Nb_Segments_2, 'Nb. Segments_2', i_pref='Disque') + +is_done = Disque_1.Compute() +text = "Disque_1.Compute" +if is_done: + logging.info(text+" OK") +else: + text = "Erreur au calcul du maillage.\n" + text + logging.info(text) + raise Exception(text) + +Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "disque.med")) if salome.sg.hasDesktop(): salome.sg.updateObjBrowser()