X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Fillet.cpp;h=ece5689f626b13ca6a84ee9107a01bcc6acc68a0;hb=05e2e4a31fa248d71445c40e35eeafa44f5d3b1b;hp=f4281991921b6c78589dde6ec7f2f8555553fc72;hpb=ae3e12ab08ba2c98c74c9f4b93812faace2af798;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Fillet.cpp b/src/SketchPlugin/SketchPlugin_Fillet.cpp index f42819919..ece5689f6 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.cpp +++ b/src/SketchPlugin/SketchPlugin_Fillet.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 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 @@ -31,6 +31,7 @@ #include "SketchPlugin_ConstraintTangent.h" #include "SketchPlugin_ConstraintRadius.h" #include "SketchPlugin_Tools.h" +#include "SketchPlugin_Validators.h" #include #include @@ -53,6 +54,7 @@ #include #include +#include #include @@ -212,37 +214,15 @@ bool SketchPlugin_Fillet::calculateFilletParameters() if (!aFilletPoint2D.get()) return false; - std::set aCoincidentPoints = - SketchPlugin_Tools::findPointsCoincidentToPoint(aFilletPoint2D); - std::set aFilletFeatures; - for (std::set::iterator aCPIt = aCoincidentPoints.begin(); - aCPIt != aCoincidentPoints.end(); ++aCPIt) { - std::shared_ptr anOwner = - std::dynamic_pointer_cast( - ModelAPI_Feature::feature((*aCPIt)->owner())); - if (anOwner && !anOwner->isExternal()) - aFilletFeatures.insert(anOwner); - } - // remove auxilary entities from set of coincident features - if (aFilletFeatures.size() > 2) { - std::set::iterator anIt = aFilletFeatures.begin(); - while (anIt != aFilletFeatures.end()) { - if ((*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) { - std::set::iterator aRemoveIt = anIt++; - aFilletFeatures.erase(aRemoveIt); - } - else - ++anIt; - } - } - if (aFilletFeatures.size() != 2) { - setError("Error: Selected point does not have two suitable edges for fillet."); + Events_InfoMessage anError; + FeaturePtr anEdge1, anEdge2; + if (!SketchPlugin_FilletVertexValidator::isValidVertex + (aPointRefAttr, anError, anEdge1, anEdge2)) { + setError(anError.messageString()); return false; } - - std::set::iterator aFIt = aFilletFeatures.begin(); - myBaseFeatures[0] = *aFIt; - myBaseFeatures[1] = *(++aFIt); + myBaseFeatures[0] = anEdge1; + myBaseFeatures[1] = anEdge2; std::shared_ptr aFilletPnt2d = aFilletPoint2D->pnt(); double aRadius = calculateFilletRadius(myBaseFeatures);