]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #712
authormpv <mpv@opencascade.com>
Fri, 3 Jul 2015 08:58:58 +0000 (11:58 +0300)
committermpv <mpv@opencascade.com>
Fri, 3 Jul 2015 08:58:58 +0000 (11:58 +0300)
src/PartSetPlugin/PartSetPlugin_Part.cpp

index 3ef0eb1928bb04f2984ef6f86a7eadf6f7bebe60..f8b348a37227979a7d1589b63007f994812b84e2 100644 (file)
@@ -55,7 +55,7 @@ std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Part::addFeature(std::string the
   ResultPartPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
   if (aResult.get()) {
     DocumentPtr aDoc = aResult->partDoc();
-    if (aDoc.get())
+    if (aDoc.get() && aDoc->isOpened())
       return aDoc->addFeature(theID);
   }
   return FeaturePtr();
@@ -66,7 +66,7 @@ int PartSetPlugin_Part::numberOfSubs() const
   ResultPartPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
   if (aResult.get()) {
     DocumentPtr aDoc = aResult->partDoc();
-    if (aDoc.get())
+    if (aDoc.get() && aDoc->isOpened())
       return aDoc->numInternalFeatures();
   }
   return 0;
@@ -77,7 +77,7 @@ std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Part::subFeature(const int theIn
   ResultPartPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
   if (aResult.get()) {
     DocumentPtr aDoc = aResult->partDoc();
-    if (aDoc.get()) {
+    if (aDoc.get() && aDoc->isOpened()) {
       return aDoc->internalFeature(theIndex);
     }
   }
@@ -89,7 +89,7 @@ int PartSetPlugin_Part::subFeatureId(const int theIndex) const
   ResultPartPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
   if (aResult.get()) {
     DocumentPtr aDoc = aResult->partDoc();
-    if (aDoc.get()) {
+    if (aDoc.get() && aDoc->isOpened()) {
       return aDoc->object(ModelAPI_Feature::group(), theIndex)->data()->featureId();
     }
   }
@@ -111,7 +111,7 @@ void PartSetPlugin_Part::removeFeature(std::shared_ptr<ModelAPI_Feature> theFeat
   ResultPartPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
   if (aResult.get()) {
     DocumentPtr aDoc = aResult->partDoc();
-    if (aDoc.get())
+    if (aDoc.get() && aDoc->isOpened())
       aDoc->removeFeature(theFeature);
   }
 }