# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2024 CEA, EDF
+#
+# 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
import SALOMEDS
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -110.000000 85.000000:T 220.000000 0.000000:T 0.000000 75.000000:T -220.000000 0.000000:WW", geomObj_1 )
SectionDroite = geompy.MakeFaceWires([Sketch_1], 1)
-geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"))
+geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbeFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
EprouvetteCourbe_1 = smesh.Mesh(EprouvetteCourbe)
+smesh.SetName(EprouvetteCourbe_1, 'EprouvetteCourbe')
Regular_1D = EprouvetteCourbe_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(50)
Nb_Segments_1.SetDistrType( 0 )
Regular_1D_2 = EprouvetteCourbe_1.Segment(geom=Compound_y)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(25)
Nb_Segments_3.SetDistrType( 0 )
-isDone = EprouvetteCourbe_1.Compute()
-smesh.SetName(EprouvetteCourbe_1, 'EprouvetteCourbe')
-EprouvetteCourbe_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med"), 0, SMESH.MED_V2_2, 1 )
+
+is_done = EprouvetteCourbe_1.Compute()
+text = "EprouvetteCourbe_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+EprouvetteCourbe_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbe.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()
smesh.SetName(SubMesh_2, 'SubMesh_2')
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
+ salome.sg.updateObjBrowser()