From b8b05fefd920f612ae06f9331cf853cf362b27d9 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 12 Jan 2017 17:41:57 +0300 Subject: [PATCH] Disable rigid constraint if selected object is not a sketch object --- src/PartSet/PartSet_Validators.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index b45f59e43..da35eb489 100755 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -196,7 +196,20 @@ bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection, } else { QList aList = theSelection->getSelected(ModuleBase_ISelection::Viewer); - return (aList.count() == 1); + int aCount = 0; + foreach (ModuleBase_ViewerPrsPtr aPrs, aList) { + ObjectPtr aObj = aPrs->object(); + if (aObj.get()) { + FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); + if (aFeature.get()) { + std::shared_ptr aSketch = + std::dynamic_pointer_cast(aFeature); + if (aSketch.get()) + aCount++; + } + } + } + return (aCount == 1); } } -- 2.39.2