# from GeomDataAPI import *
# from GeomAlgoAPI import *
-__updated__ = "2014-12-16"
+__updated__ = "2014-12-26"
#=========================================================================
# Creation and activation of documents
assert(aSession.activeDocument())
assert(aSession.activeDocument().id() == "root")
# check all opened docs
-for aDoc in aSession.allOpenedDocuments():
- assert(aDoc)
+allDocsList = aSession.allOpenedDocuments()
+assert(len(allDocsList) != 0)
# Activate Part_1 doc back for further testing
aSession.startOperation()
aSession.setActiveDocument(aSession.document("Part_1"), False)
# Duplicate the document
assert(aSession.moduleDocument().size("Parts") == 1)
aSession.startOperation()
-aSession.moduleDocument().addFeature("Duplicate")
+aPart.addFeature("Duplicate")
aSession.finishOperation()
assert(aSession.moduleDocument().size("Parts") == 2)
aCopyOfPart = aSession.activeDocument()
#=========================================================================
assert(aSession.moduleDocument().size("Parts") == 2)
aSession.startOperation()
-aSession.moduleDocument().addFeature("Remove")
+aPart.addFeature("Remove")
aSession.finishOperation()
+# First part is deleted, but active is Part_2, so, it is still active
assert(aSession.moduleDocument().size("Parts") == 1)
-assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
+assert(aSession.activeDocument().id() == aCopyOfPart.id())
# Remove another one document
aSession.startOperation()
-aDoc1 = aSession.document("Part_1")
-aSession.setActiveDocument(aDoc1, False)
-aSession.moduleDocument().addFeature("Remove")
+aDoc2 = aSession.document("Part_2")
+aSession.setActiveDocument(aDoc2, False)
+aDoc2.addFeature("Remove")
aSession.finishOperation()
assert(aSession.moduleDocument().size("Parts") == 0)
assert(aSession.activeDocument())
-#=========================================================================
-# Trying to duplicate/remove the root
-#=========================================================================
-aSession.startOperation()
-aSession.moduleDocument().addFeature("Duplicate")
-aSession.finishOperation()
-assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
-assert(aSession.moduleDocument().size("Parts") == 0)
-aSession.startOperation()
-aSession.moduleDocument().addFeature("Remove")
-aSession.finishOperation()
-assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
-assert(aSession.moduleDocument().size("Parts") == 0)
-#=========================================================================
-# End of test
-#=========================================================================