Salome HOME
Issue #3170: Impossible to close Application errors dialog box
authorazv <azv@opencascade.com>
Fri, 28 Feb 2020 08:45:35 +0000 (11:45 +0300)
committerazv <azv@opencascade.com>
Fri, 28 Feb 2020 08:45:35 +0000 (11:45 +0300)
Update fillet to exclude auxiliary segments from the processing.

src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_Fillet.cpp
src/SketchPlugin/Test/Test3170.py [new file with mode: 0644]

index fcd1899e10b16f56c531cadff3ff8084a78fd737..91ddabcc94059eb202a21b76ee93e3538263bb47 100644 (file)
@@ -222,6 +222,7 @@ ADD_UNIT_TESTS(
   Test3087_2.py
   Test3132.py
   Test3154.py
+  Test3170.py
   TestArcBehavior.py
   TestBSplineAddPole.py
   TestChangeSketchPlane1.py
index 9507cad1a9970b0b557863383d559d498b114031..2e55f8c0c2ae6e4b4975098b8a7af3c6bb5005f2 100644 (file)
@@ -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<FeaturePtr>::iterator anIt = aFilletFeatures.begin();
+    while (anIt != aFilletFeatures.end()) {
+      if ((*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) {
+        std::set<FeaturePtr>::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 (file)
index 0000000..e054c00
--- /dev/null
@@ -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())