From 1f569bab11cf0810960f32e508f24f3cd8deb407 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 7 Apr 2017 15:02:11 +0300 Subject: [PATCH] External edges color should not be changed when sketch is fully constrained. --- src/PartSet/PartSet_OverconstraintListener.cpp | 3 ++- src/PartSet/PartSet_SketcherMgr.cpp | 7 +++++++ src/PartSet/PartSet_SketcherMgr.h | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/PartSet/PartSet_OverconstraintListener.cpp b/src/PartSet/PartSet_OverconstraintListener.cpp index d0de78c04..2fd930ca7 100755 --- a/src/PartSet/PartSet_OverconstraintListener.cpp +++ b/src/PartSet/PartSet_OverconstraintListener.cpp @@ -79,7 +79,8 @@ void PartSet_OverconstraintListener::getCustomColor(const ObjectPtr& theObject, if (myIsFullyConstrained) { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); // only entity features has custom color when sketch is fully constrained - if (aFeature.get() && PartSet_SketcherMgr::isEntity(aFeature->getKind())) { + if (aFeature.get() && PartSet_SketcherMgr::isEntity(aFeature->getKind()) && + !PartSet_SketcherMgr::isExternalFeature(aFeature)) { PartSet_Module* aModule = module(); CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch(); // the given object is sub feature of the current sketch(created or edited) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 6128e4038..774fc1fcb 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -838,6 +838,13 @@ bool PartSet_SketcherMgr::isEntity(const std::string& theId) (theId == SketchPlugin_Circle::ID()); } +bool PartSet_SketcherMgr::isExternalFeature(const FeaturePtr& theFeature) +{ + std::shared_ptr aSPFeature = + std::dynamic_pointer_cast(theFeature); + return aSPFeature.get() && aSPFeature->isExternal(); +} + bool PartSet_SketcherMgr::isDistanceOperation(ModuleBase_Operation* theOperation) { std::string anId = theOperation ? theOperation->id().toStdString() : ""; diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 08d8ffd79..5fb1931fd 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -129,6 +129,11 @@ public: /// \return a boolean value static bool isEntity(const std::string& theId); + /// Returns whether the feature has external attribute filled with 'true' value + /// \param theFeature a feature object + /// \return a boolean value + static bool isExternalFeature(const FeaturePtr& theFeature); + /// Returns whether the current operation is a sketch distance - lenght, distance or radius /// \param theOperation the operation /// \return a boolean value -- 2.39.2