Salome HOME
Fix for the issue #17867 : ExtrusionCut doesn't work
authormpv <mpv@opencascade.com>
Thu, 17 Oct 2019 16:12:45 +0000 (19:12 +0300)
committermpv <mpv@opencascade.com>
Thu, 17 Oct 2019 16:12:45 +0000 (19:12 +0300)
Allow to select start point of an arc even due to the 2D->3D conversion produces 3.e-7 error in coordinates.

src/Model/Model_Data.h
src/PartSet/PartSet_Tools.cpp

index f2698eef9fbac21046055932a943f5c31911953f..9f26d8de1050bd4a25b85f481e00f243534c7906 100644 (file)
@@ -326,7 +326,6 @@ private:
   MODEL_EXPORT virtual bool isPrecedingAttribute(const std::string& theAttribute1,
                                                  const std::string& theAttribute2) const;
 
-  friend class Model_Objects;
 };
 
 /// Generic method to register back reference, used in referencing attributes.
index 3ef5b735f9fd6124b25fce78ca250a7aff826e6d..0ff7ad2e55b19e5261693d46cafb631bbd7d8343 100644 (file)
@@ -648,6 +648,7 @@ AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj,
           aFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
         std::list<AttributePtr>::const_iterator anIt = anAttiributes.begin(),
                                                 aLast = anAttiributes.end();
+        double aMinDistance = 1.e-6; // searching for point with minimal distance and < 1.e-6
         for (; anIt != aLast && !anAttribute; anIt++) {
           std::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
             std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
@@ -656,9 +657,12 @@ AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj,
 
           std::shared_ptr<GeomAPI_Pnt> aPnt =
             convertTo3D(aCurPoint->x(), aCurPoint->y(), theSketch);
-          if (aPnt && (aPnt->distance(aValue) < Precision::Confusion())) {
-            anAttribute = aCurPoint;
-            break;
+          if (aPnt) {
+            double aDistance = aPnt->distance(aValue);
+            if (aDistance < aMinDistance) {
+              anAttribute = aCurPoint;
+              aMinDistance = aPnt->distance(aValue);
+            }
           }
         }
       }