From: mpv Date: Thu, 17 Oct 2019 16:12:45 +0000 (+0300) Subject: Fix for the issue #17867 : ExtrusionCut doesn't work X-Git-Tag: V9_5_0a1~167^2~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0ea6294d5f1a664fbf05fc2cb05ba74e25bac785;p=modules%2Fshaper.git Fix for the issue #17867 : ExtrusionCut doesn't work Allow to select start point of an arc even due to the 2D->3D conversion produces 3.e-7 error in coordinates. --- diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index f2698eef9..9f26d8de1 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -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. diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 376bce7ce..fbb50228f 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -650,6 +650,7 @@ AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj, aFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list::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 aCurPoint = std::dynamic_pointer_cast(*anIt); @@ -658,9 +659,12 @@ AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj, std::shared_ptr 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); + } } } }