From 06e0481de591cbe47b8aa35a265d66bbd28cf8f2 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 28 Feb 2020 11:45:35 +0300 Subject: [PATCH] Issue #3170: Impossible to close Application errors dialog box Update fillet to exclude auxiliary segments from the processing. --- src/SketchPlugin/CMakeLists.txt | 1 + src/SketchPlugin/SketchPlugin_Fillet.cpp | 12 ++++++ src/SketchPlugin/Test/Test3170.py | 52 ++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 src/SketchPlugin/Test/Test3170.py diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index fcd1899e1..91ddabcc9 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -222,6 +222,7 @@ ADD_UNIT_TESTS( Test3087_2.py Test3132.py Test3154.py + Test3170.py TestArcBehavior.py TestBSplineAddPole.py TestChangeSketchPlane1.py diff --git a/src/SketchPlugin/SketchPlugin_Fillet.cpp b/src/SketchPlugin/SketchPlugin_Fillet.cpp index 9507cad1a..2e55f8c0c 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.cpp +++ b/src/SketchPlugin/SketchPlugin_Fillet.cpp @@ -223,6 +223,18 @@ bool SketchPlugin_Fillet::calculateFilletParameters() if (anOwner && !anOwner->isExternal()) aFilletFeatures.insert(anOwner); } + // remove auxilary entities from set of coincident features + if (aFilletFeatures.size() > 2) { + std::set::iterator anIt = aFilletFeatures.begin(); + while (anIt != aFilletFeatures.end()) { + if ((*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) { + std::set::iterator aRemoveIt = anIt++; + aFilletFeatures.erase(aRemoveIt); + } + else + ++anIt; + } + } if (aFilletFeatures.size() != 2) { setError("Error: Selected point does not have two suitable edges for fillet."); return false; diff --git a/src/SketchPlugin/Test/Test3170.py b/src/SketchPlugin/Test/Test3170.py new file mode 100644 index 000000000..e054c00e9 --- /dev/null +++ b/src/SketchPlugin/Test/Test3170.py @@ -0,0 +1,52 @@ +# Copyright (C) 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() +Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(-17.82085345143611, 21.43637119696745, -32.3626718085896, -17.44370962732489) +SketchLine_2 = Sketch_1.addLine(-32.3626718085896, -17.44370962732489, 6.049253461791531, -11.27075409452475) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(6.049253461791531, -11.27075409452475, -17.82085345143611, 21.43637119696745) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint()) +SketchLine_4 = Sketch_1.addLine(-32.3626718085896, -17.44370962732489, -5.812861704098991, 4.982867573918385) +SketchLine_4.setAuxiliary(True) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint()) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result()) +model.end() + +DoF = model.dof(Sketch_1) + +model.begin() +Sketch_1.setFillet(SketchLine_2.startPoint()) +DoF += 3 +model.end() + +assert(model.dof(Sketch_1) == DoF) + +model.testNbSubFeatures(Sketch_1, "SketchPoint", 0) +model.testNbSubFeatures(Sketch_1, "SketchLine", 4) +model.testNbSubFeatures(Sketch_1, "SketchArc", 1) +model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 5) +model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 2) + +assert(model.checkPythonDump()) -- 2.30.2