From: jfa Date: Fri, 20 Sep 2024 12:07:23 +0000 (+0100) Subject: [bos #42429] [EDF] SHAPER_Models_coronavirus UNSTABLE since OCT 7.8.0. Introduced... X-Git-Tag: V9_14_0a1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Ftlpr%2F71%2Fhead;p=modules%2Fshaper.git [bos #42429] [EDF] SHAPER_Models_coronavirus UNSTABLE since OCT 7.8.0. Introduced new test case for failing sub-case of coronavirus.py --- diff --git a/src/ExchangeAPI/ExchangeAPI_Export.h b/src/ExchangeAPI/ExchangeAPI_Export.h index c36fb7e53..214fd19c1 100644 --- a/src/ExchangeAPI/ExchangeAPI_Export.h +++ b/src/ExchangeAPI/ExchangeAPI_Export.h @@ -194,9 +194,9 @@ PyObject* exportToXAOMem(const std::shared_ptr & thePart, /** \ingroup CPPHighAPI * \brief Export selected features or the whole part to the binary file. - * \param thePart Part document - * \param theFilePath File to store the part (recommended extension is .shaperpart) - * \param Selected objects list. If empty, the whole part is saved. + * \param thePart The part document to be saved. + * \param theFilePath The file path where the part document will be stored. It is recommended to use the .shaperpart extension for the file. + * \param theSelected A list of selected objects within the part document to be saved. If this list is empty, the entire part document will be saved. */ EXCHANGEAPI_EXPORT void exportPart( const std::shared_ptr & thePart, diff --git a/src/ExchangePlugin/doc/exportFeature.rst b/src/ExchangePlugin/doc/exportFeature.rst index a14bc3449..8f8d61be8 100644 --- a/src/ExchangePlugin/doc/exportFeature.rst +++ b/src/ExchangePlugin/doc/exportFeature.rst @@ -20,7 +20,7 @@ Specify file name and press **Save** button to export the file. **Cancel** butto **TUI Command**: -One cannot export entire PartSet into a single file from python interface, but it is possible to save Shaper session contents into a directory: +It is not possible to export the entire PartSet into a single file using the Python interface, but the contents of a Shaper session can be saved into a directory: .. py:function:: ModelAPI_Session.save(FolderNameString, FilesList) @@ -30,7 +30,7 @@ One cannot export entire PartSet into a single file from python interface, but i Result """""" -The Result of operation is some exported files. +The result of the operation is several files saved in the specified directory. **See Also** a sample TUI Script of :ref:`tui_save_session` operation. diff --git a/src/FeaturesPlugin/Test/TestFillet_NearSeamEdge.py b/src/FeaturesPlugin/Test/TestFillet_NearSeamEdge.py new file mode 100644 index 000000000..d6a81d376 --- /dev/null +++ b/src/FeaturesPlugin/Test/TestFillet_NearSeamEdge.py @@ -0,0 +1,91 @@ +# Copyright (C) 2018-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 +# + +from salome.shaper import model +from GeomAPI import GeomAPI_Shape + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() + +#----------------------------------------------------------------- +model.addParameter(Part_1_doc, "Big_R", '50') +model.addParameter(Part_1_doc, "Big_H", '50') +model.addParameter(Part_1_doc, "Small_R", '5') +model.addParameter(Part_1_doc, "Angle", '10') +#----------------------------------------------------------------- +fillet_radius = model.addParameter(Part_1_doc, "Fillet_R", '4.45') +#----------------------------------------------------------------- + +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "Big_R", "Big_H") +Point_1 = model.addPoint(Part_1_doc, "0", "0", "Big_H/2") +Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("EDGE", "PartSet/OX"), "Small_R", "Big_R*1.25") +Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Cylinder_2_1")], axis = model.selection("EDGE", "PartSet/OZ"), angle = "Angle") +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Rotation_1_1")]) + +Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Fuse_1_1/Generated_Edge&Cylinder_2_1/Face_1&Cylinder_1_1/Face_1")], "Fillet_R") +model.do() + +assert(Fillet_1.feature().error() == "") +model.testNbResults(Fillet_1, 1) +model.testNbSubResults(Fillet_1, [0]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.FACE, [6]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [16]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [32]) +model.testResultsVolumes(Fillet_1, [393818.53]) + +fillet_radius.setValue(4.46) +model.do() + +assert(Fillet_1.feature().error() == "") +model.testNbResults(Fillet_1, 1) +model.testNbSubResults(Fillet_1, [0]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.FACE, [6]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [24]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [48]) +model.testResultsVolumes(Fillet_1, [393819.158]) + +fillet_radius.setValue(4.47) +model.do() + +assert(Fillet_1.feature().error() == "") +model.testNbResults(Fillet_1, 1) +model.testNbSubResults(Fillet_1, [0]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.FACE, [6]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [24]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [48]) +model.testResultsVolumes(Fillet_1, [393819.785]) + +fillet_radius.setValue(4.48) +model.do() + +assert(Fillet_1.feature().error() == "") +model.testNbResults(Fillet_1, 1) +model.testNbSubResults(Fillet_1, [0]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.FACE, [8]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [30]) +model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [60]) +model.testResultsVolumes(Fillet_1, [393820.41]) + +model.end() diff --git a/src/FeaturesPlugin/tests.set b/src/FeaturesPlugin/tests.set index 832334844..2611fad2e 100644 --- a/src/FeaturesPlugin/tests.set +++ b/src/FeaturesPlugin/tests.set @@ -318,6 +318,7 @@ SET(TEST_NAMES_PARA TestFillet1.py TestFillet_ErrorMsg.py TestFillet_History.py + TestFillet_NearSeamEdge.py TestScale1.py TestScale2.py Test1816.py diff --git a/test.models/coronavirus.py b/test.models/coronavirus.py index 3d94f8000..c87b63bb9 100644 --- a/test.models/coronavirus.py +++ b/test.models/coronavirus.py @@ -46,6 +46,7 @@ indices = np.arange(0, num_pts, dtype=float) + 0.5 phi0 = np.arccos(1 - 2*indices/num_pts) theta0 = np.pi * (1 + 5**0.5) * indices # ajout de bruit Gaussien pour rendre légèrement aléatoire les positions des tubes : +np.random.seed(0) # This allows to avoid randomness and appearance of fillet bug (issue #42429), while increasing num_pts over 50 still may introduce a position where the fillet problem occurs! bruit=np.pi*np.random.normal(0, bruit, num_pts) # std = np.pi*0.05 phi = phi0+bruit theta = theta0+bruit