From ca94318894d6cc22024c65f444b223951d15abc8 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 18 Nov 2019 12:30:14 +0300 Subject: [PATCH] Fix for the issue #3081 : show free points must not show projected/external points --- src/SketcherPrs/SketcherPrs_Tools.cpp | 31 ++++++++++++++++++--------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index 394a638ff..4e9522fd1 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -202,17 +202,28 @@ std::list getFreePoints(const CompositeFeaturePtr& theSketch) anObjIt != anObjects.end(); ++anObjIt) { FeaturePtr aCurrent = ModelAPI_Feature::feature(*anObjIt); if (aCurrent && aCurrent->getKind() == SketchPlugin_Point::ID()) { - // check point is not referred by any constraints - const std::set& aRefs = aCurrent->data()->refsToMe(); - std::set::iterator aRIt = aRefs.begin(); - for (; aRIt != aRefs.end(); ++aRIt) { - FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner()); - std::shared_ptr aRefConstr = - std::dynamic_pointer_cast(aRefFeat); - if (aRefConstr) - break; + // check point is not referred by any constraints: the feature and result of point + bool aIsFree = true; + for(int aKind = 0; aIsFree && aKind < 2; aKind++) { // 0 for feature, 1 for result + ObjectPtr aReferenced = aCurrent; + if (aKind == 1) + if (!aCurrent->results().empty()) + aReferenced = aCurrent->firstResult(); + else + break; + const std::set& aRefs = aReferenced->data()->refsToMe(); + std::set::iterator aRIt = aRefs.begin(); + for (; aRIt != aRefs.end(); ++aRIt) { + FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner()); + std::shared_ptr aRefConstr = + std::dynamic_pointer_cast(aRefFeat); + if (aRefConstr) { + aIsFree = false; + break; + } + } } - if (aRIt == aRefs.end()) + if (aIsFree) aFreePoints.push_back(aCurrent->lastResult()); } } -- 2.39.2