]> SALOME platform Git repositories - modules/shaper.git/commitdiff
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)
committervsv <vsv@opencascade.com>
Wed, 6 Nov 2019 08:27:35 +0000 (11:27 +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 376bce7ce3a62a0c79a6ad922d928adbd7fde5f1..fbb50228faf57290a384d347d72b2e8b0b0dffec 100644 (file)
@@ -650,6 +650,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);
@@ -658,9 +659,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);
+            }
           }
         }
       }