]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Disable rigid constraint if selected object is not a sketch object
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 12 Jan 2017 14:41:57 +0000 (17:41 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 12 Jan 2017 14:41:57 +0000 (17:41 +0300)
src/PartSet/PartSet_Validators.cpp

index b45f59e439a84773d00ac47018a27ea490e28b5f..da35eb489e393007fd0d3b3a549a2d4a54f2f1d1 100755 (executable)
@@ -196,7 +196,20 @@ bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection,
   } else {
     QList<ModuleBase_ViewerPrsPtr> 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<SketchPlugin_Feature> aSketch =
+            std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+          if (aSketch.get())
+            aCount++;
+        }
+      }
+    }
+    return (aCount == 1);
   }
 }