From: GERALD NICOLAS Date: Wed, 15 Sep 2021 11:31:55 +0000 (+0200) Subject: Second test X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6eef968be6c657cd5d0fb9002f424a6e29ec17a8;p=modules%2Fshaper.git Second test --- diff --git a/src/PythonAddons/Test/TestpipeNetwork.py b/src/PythonAddons/Test/TestpipeNetwork.py deleted file mode 100755 index 90a82cc04..000000000 --- a/src/PythonAddons/Test/TestpipeNetwork.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2014-2021 CEA/DEN, 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 -# -"""Test de la création du réseau de tuyaux""" - -__revision__ = "V01.03" - -import os - -from ModelAPI import * - -aSession = ModelAPI_Session.get() - -def getFilePath(fileName): - """Le fichier décrivant le réseau""" - path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "pipeNetwork") - return os.path.join(path, fileName) - -#theFile = getFilePath("pipeNetwork_2par2.txt") -theFile = getFilePath("pipeNetwork_ligne.txt") - -aSession.startOperation("Create part for pipe network") -aPartFeature = aSession.moduleDocument().addFeature("Part") -aSession.finishOperation() -aPart = aSession.activeDocument() - -aSession.startOperation("Import file") -aFeatureKind = "pipeNetwork" -anImportFeature = aPart.addFeature(aFeatureKind) -aFieldName = "file_path" -aFile = anImportFeature.string(aFieldName) -aFile.setValue(theFile) -aSession.finishOperation() - -assert(aPart.size("Construction") == 46), "Right number of construction: {}".format(aPart.size("Construction")) - -assert(aPart.size("Folders") == 1), "Right number of folders: {}".format(aPart.size("Folders")) diff --git a/src/PythonAddons/Test/TestpipeNetwork_2par2.py b/src/PythonAddons/Test/TestpipeNetwork_2par2.py new file mode 100755 index 000000000..90a82cc04 --- /dev/null +++ b/src/PythonAddons/Test/TestpipeNetwork_2par2.py @@ -0,0 +1,52 @@ +# Copyright (C) 2014-2021 CEA/DEN, 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 +# +"""Test de la création du réseau de tuyaux""" + +__revision__ = "V01.03" + +import os + +from ModelAPI import * + +aSession = ModelAPI_Session.get() + +def getFilePath(fileName): + """Le fichier décrivant le réseau""" + path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "pipeNetwork") + return os.path.join(path, fileName) + +#theFile = getFilePath("pipeNetwork_2par2.txt") +theFile = getFilePath("pipeNetwork_ligne.txt") + +aSession.startOperation("Create part for pipe network") +aPartFeature = aSession.moduleDocument().addFeature("Part") +aSession.finishOperation() +aPart = aSession.activeDocument() + +aSession.startOperation("Import file") +aFeatureKind = "pipeNetwork" +anImportFeature = aPart.addFeature(aFeatureKind) +aFieldName = "file_path" +aFile = anImportFeature.string(aFieldName) +aFile.setValue(theFile) +aSession.finishOperation() + +assert(aPart.size("Construction") == 46), "Right number of construction: {}".format(aPart.size("Construction")) + +assert(aPart.size("Folders") == 1), "Right number of folders: {}".format(aPart.size("Folders")) diff --git a/src/PythonAddons/Test/TestpipeNetwork_parligne.py b/src/PythonAddons/Test/TestpipeNetwork_parligne.py new file mode 100755 index 000000000..90a82cc04 --- /dev/null +++ b/src/PythonAddons/Test/TestpipeNetwork_parligne.py @@ -0,0 +1,52 @@ +# Copyright (C) 2014-2021 CEA/DEN, 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 +# +"""Test de la création du réseau de tuyaux""" + +__revision__ = "V01.03" + +import os + +from ModelAPI import * + +aSession = ModelAPI_Session.get() + +def getFilePath(fileName): + """Le fichier décrivant le réseau""" + path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "pipeNetwork") + return os.path.join(path, fileName) + +#theFile = getFilePath("pipeNetwork_2par2.txt") +theFile = getFilePath("pipeNetwork_ligne.txt") + +aSession.startOperation("Create part for pipe network") +aPartFeature = aSession.moduleDocument().addFeature("Part") +aSession.finishOperation() +aPart = aSession.activeDocument() + +aSession.startOperation("Import file") +aFeatureKind = "pipeNetwork" +anImportFeature = aPart.addFeature(aFeatureKind) +aFieldName = "file_path" +aFile = anImportFeature.string(aFieldName) +aFile.setValue(theFile) +aSession.finishOperation() + +assert(aPart.size("Construction") == 46), "Right number of construction: {}".format(aPart.size("Construction")) + +assert(aPart.size("Folders") == 1), "Right number of folders: {}".format(aPart.size("Folders")) diff --git a/src/PythonAddons/macros/pipeNetwork/pipeNetwork_2par2.txt b/src/PythonAddons/macros/pipeNetwork/pipeNetwork_2par2.txt index 74558cd53..4a12d624e 100644 --- a/src/PythonAddons/macros/pipeNetwork/pipeNetwork_2par2.txt +++ b/src/PythonAddons/macros/pipeNetwork/pipeNetwork_2par2.txt @@ -3,16 +3,19 @@ nodes section # Le tuyau principal id_noeud1 - 0 0 0 id_noeud2 - 10 -10 0 -id_noeud3 - 20 -20 0 -id_noeud4 - 21 -21 10 -id_noeud5 - 30 -21 10 -id_noeud6 - 30 -10 10 -id_noeud7 - 30 0 10 +id_noeud3 - 15 -15 0 +id_noeud4 - 20 -20 0 +id_noeud5 - 21 -21 10 +id_noeud6 - 30 -21 10 +id_noeud7 - 30 -10 10 +id_noeud8 - 30 -5 10 +id_noeud9 - 30 0 10 # Les deux piquages id_noeudA id_noeud2 -5 -5 10 id_noeudB id_noeudA 0 5 10 id_noeudC - 30 -10 20 id_noeudD id_noeudC 5 5 5 +id_noeudE id_noeudD 5 5 5 # Connectivité : connectivity section @@ -24,14 +27,17 @@ id_noeud3 id_noeud4 id_noeud4 id_noeud5 id_noeud5 id_noeud6 id_noeud6 id_noeud7 -id_noeud2 id_noeudA -id_noeudA id_noeudB -id_noeud6 id_noeudC +id_noeud7 id_noeud8 +id_noeud8 id_noeud9 +id_noeudA id_noeud2 +id_noeudB id_noeudA +id_noeud7 id_noeudC id_noeudC id_noeudD +id_noeudD id_noeudE # Congés de raccordement : fillets section id_noeud2 angular_connection -id_noeud3 radius=1 -id_noeud4 angular_connection -id_noeud5 radius=2 +id_noeud4 radius=1 +id_noeud5 angular_connection +id_noeud6 radius=2