From: vsv Date: Thu, 12 Jan 2017 14:41:57 +0000 (+0300) Subject: Disable rigid constraint if selected object is not a sketch object X-Git-Tag: V_2.7.0~344^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b8b05fefd920f612ae06f9331cf853cf362b27d9;p=modules%2Fshaper.git Disable rigid constraint if selected object is not a sketch object --- 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); } }