Salome HOME
Merge branch 'Dev_1.4.0' of newgeom:newgeom into Dev_1.4.0
[modules/shaper.git] / src / Model / Model_Document.cpp
index b163538169cef52903f074f3939b2fbce540a132..4ff65b48c699da6b4d07e62764f267cd22fdebf1 100644 (file)
@@ -105,6 +105,7 @@ bool Model_Document::load(const char* theFileName, DocumentPtr theThis)
   }
   TCollection_ExtendedString aPath(DocFileName(theFileName, myID));
   PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
+  Handle(TDocStd_Document) aLoaded;
   try {
     aStatus = anApp->Open(aPath, aLoaded);
   } catch (Standard_Failure) {
@@ -185,7 +186,13 @@ bool Model_Document::load(const char* theFileName, DocumentPtr theThis)
     aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
     // this is done in Part result "activate", so no needed here. Causes not-blue active part.
     // aSession->setActiveDocument(anApp->getDocument(myID), true);
-  }
+  } else { // open failed, but new documnet was created to work with it: inform the model
+    static std::shared_ptr<Events_Message> aMsg(
+        new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)));
+    Events_Loop::loop()->send(aMsg);
+    TDF_LabelList anEmpty;
+    myObjs->synchronizeFeatures(anEmpty, true, true);
+  } 
   return !isError;
 }