static Model_Session* myImpl = new Model_Session();
-// t oredirect all calls to the root document
+// to redirect all calls to the root document
#define ROOT_DOC std::dynamic_pointer_cast<Model_Document>(moduleDocument())
bool Model_Session::load(const char* theFileName)
myOperationAttachedToNext = false;
}
setCheckTransactions(true);
- // here the update mechanism may work after abort, so, supress the warnings about
+ // here the update mechanism may work after abort, so, suppress the warnings about
// modifications outside of the transactions
bool aWasCheck = myCheckTransactions;
myCheckTransactions = false;
std::shared_ptr<ModelAPI_Document> aPrevious = myCurrentDoc;
myCurrentDoc = theDoc;
if (theDoc.get() && theSendSignal) {
- // this must be before the synchronisation call because features in PartSet lower than this
+ // this must be before the synchronization call because features in PartSet lower than this
// part feature must be disabled and don't recomputed anymore (issue 1156,
// translation feature is failed on activation of Part 2)
if (isOperation()) { // do it only in transaction, not on opening of document
}
}
}
- // syncronize the document: it may be just opened or opened but removed before
+ // synchronize the document: it may be just opened or opened but removed before
std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(theDoc);
if (aDoc.get()) {
bool aWasChecked = myCheckTransactions;
new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)));
Events_Loop::loop()->send(aMsg);
}
- // make the current state correct and synchronised in the module and sub-documents
+ // make the current state correct and synchronized in the module and sub-documents
if (isOperation()) { // do it only in transaction, not on opening of document
if (myCurrentDoc == moduleDocument()) {
// make the current feature the latest in root, in previous root current become also last
}
if (!isOperation) {
finishOperation();
- // append this transaction to the previous one: ne don't need this separated operation in list
+ // append this transaction to the previous one: don't need this separated operation in list
ROOT_DOC->appendTransactionToPrevious();
}
}
TestGeomNamingSketchPlane.py
TestGeomNamingBoxWithFillet.py
TestContainerSelector.py
+ TestSaveOpen.py
)
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Point_2 = model.addPoint(partSet, 1, 2, 3)
+Point_name = Point_2.name()
+model.end()
+
+# check save document in a current folder
+aSession = ModelAPI_Session.get()
+aFiles = StringList()
+aSession.save(".", aFiles)
+assert(len(aFiles) == 1)
+
+# check open of the same document
+assert(aSession.load(".") == False) # error because this document is already opened
+
+# close the current document
+aSession.closeAll()
+
+# open again: it must be correct now
+assert(aSession.load("."))
+
+# check the created point is opened
+partSet = model.moduleDocument()
+assert(partSet.size("Features") == 1)
+assert(partSet.object("Features", 0).data().name() == Point_name)
else if (Abs(dLength) < tol && theShape1.ShapeType() <= TopAbs_FACE) {
// equal values possible on shapes such as two halves of a sphere and
// a membrane inside the sphere
+// LCOV_EXCL_START
+ // this part of code is taken from GEOM module, but can not reproduce in SHAPER
Bnd_Box box1,box2;
BRepBndLib::Add(theShape1, box1);
if (!box1.IsVoid()) {
}
}
}
- } else // compare adresses if shapes are geometrically equal
+// LCOV_EXCL_START
+ } else // compare addresses if shapes are geometrically equal
return theShape1.TShape().get() > theShape2.TShape().get();
}