From: mpv Date: Tue, 13 Oct 2020 07:58:42 +0000 (+0300) Subject: Fix for the issue #20170 [CEA] Error when loading python dump: attribute "ExternalFea... X-Git-Tag: V9_6_0b1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0fb13af3e5201ea484394dec811cddf6104e8029;p=modules%2Fshaper.git Fix for the issue #20170 [CEA] Error when loading python dump: attribute "ExternalFeature" is invalid. Also non-regression unit-test is added. --- diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 6c3a491c5..1a41196fc 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -714,7 +714,9 @@ void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, bool anOldSubShapeNotInTree = !isShapeInTree(aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel); if (anOldSubShapeAlreadyProcessed || anOldSubShapeNotInTree) { - if (theSaveOldIfNotInTree) { + // The second condition is added due to #20170 because sub-shape must be added to real parent shape, + // not the reference. The naming name of pure reference is not registered in the document. + if (theSaveOldIfNotInTree && !aData->shapeLab().IsAttribute(TDF_Reference::GetID())) { std::string aSelectionName = theName + "Selected"; generated(anOldSubShape, aSelectionName, false); } else diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index dd2f4acd9..68b34a177 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -267,4 +267,5 @@ ADD_UNIT_TESTS(TestConstants.py Test19912.py Test19932.py Test19989.py + Test20170.py ) diff --git a/src/ModelAPI/Test/Test20170.py b/src/ModelAPI/Test/Test20170.py new file mode 100644 index 000000000..d3ed72eda --- /dev/null +++ b/src/ModelAPI/Test/Test20170.py @@ -0,0 +1,35 @@ +# Copyright (C) 2014-2020 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 +# +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(8, 23, 2.5) +SketchCircle_2 = Sketch_1.addCircle(14, 17, 2.5) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 10, 0) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")]) +Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_2/Modified_Face&Sketch_1/SketchCircle_2_2][Compound_1_1_2/Modified_Face&Extrusion_1_2/To_Face]")], 2, keepSubResults = True) +Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Fillet_1_1_2/GF:Fillet&Fillet_1_1_2/FilletSelected")]) +model.end() + +assert(model.checkPythonDump())