]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2157: Fix incorrect searching of features coincident to fillet point
authorazv <azv@opencascade.com>
Mon, 19 Feb 2018 07:32:52 +0000 (10:32 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Feb 2018 07:59:19 +0000 (10:59 +0300)
Signed-off-by: mpv <mpv@opencascade.com>
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_Fillet.cpp
src/SketchPlugin/Test/Test2157.py [new file with mode: 0644]

index cc169af8655f52340474e9afed3fd4746cb7fee6..34ddf4b9a3c9e0d9c21b307c5e5fe53a1211a017 100644 (file)
@@ -235,6 +235,7 @@ ADD_UNIT_TESTS(TestSketchPointLine.py
                Test2393.py
                Test2425.py
                Test2440.py
+               Test2157.py
 )
 
 if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE})
index 106b3a7cf45b5441efbd6a6291c5347fe9676f77..d2e46b7c3f28993be71d1f4fe737ddedf15d6a4b 100644 (file)
@@ -203,8 +203,15 @@ bool SketchPlugin_Fillet::calculateFilletParameters()
   if (!aFilletPoint2D.get())
     return false;
 
-  std::set<FeaturePtr> aFilletFeatures =
-      SketchPlugin_Tools::findFeaturesCoincidentToPoint(aFilletPoint2D);
+  std::set<AttributePoint2DPtr> aCoincidentPoints =
+      SketchPlugin_Tools::findPointsCoincidentToPoint(aFilletPoint2D);
+  std::set<FeaturePtr> aFilletFeatures;
+  for (std::set<AttributePoint2DPtr>::iterator aCPIt = aCoincidentPoints.begin();
+       aCPIt != aCoincidentPoints.end(); ++aCPIt) {
+    FeaturePtr anOwner = ModelAPI_Feature::feature((*aCPIt)->owner());
+    if (anOwner)
+      aFilletFeatures.insert(anOwner);
+  }
   if (aFilletFeatures.size() != 2) {
     setError("Error: Selected point does not have two suitable edges for fillet.");
     return false;
diff --git a/src/SketchPlugin/Test/Test2157.py b/src/SketchPlugin/Test/Test2157.py
new file mode 100644 (file)
index 0000000..0635801
--- /dev/null
@@ -0,0 +1,41 @@
+## Copyright (C) 2018-20xx  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<mailto: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"))
+SketchLine_1 = Sketch_1.addLine(14.02956299682377, 22.92420172826143, 50.52730937285911, 55.74918048752026)
+SketchLine_2 = Sketch_1.addLine(37.41590909090908, 14.23181818181818, 32.3113094484989, 39.36625633556781)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
+SketchLine_3 = Sketch_1.addLine(32.3113094484989, 39.36625633556781, 60.59999999999999, 33.28409090909091)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+model.do()
+
+SketchFillet_1 = Sketch_1.setFillet(SketchLine_2.endPoint())
+model.do()
+
+assert(Sketch_1.feature().error() == "")
+assert(Sketch_1.solverError().value() == "")
+
+model.end()