1 from ModelAPI import *
\r
2 aSession = ModelAPI_Session.get()
\r
3 aDoc = aSession.moduleDocument()
\r
4 assert(not aSession.canUndo())
\r
5 assert(not aSession.canRedo())
\r
7 aSession.startOperation()
\r
8 aFeature = aDoc.addFeature("Point")
\r
9 # Since validators are introduced we have to initialize all
\r
10 # the feature's attributes
\r
11 aFeature.string("creation_method").setValue("by_xyz")
\r
12 aFeature.real("x").setValue(1.)
\r
13 aFeature.real("y").setValue(-1.)
\r
14 aFeature.real("z").setValue(0.)
\r
15 aFeatureName = aFeature.name()
\r
16 # "2" is because Origin is the first point
\r
17 assert(aFeatureName == "Point_2")
\r
20 aSession.finishOperation()
\r
22 assert(aDoc.size("Construction") == 8)
\r
23 assert(aSession.canUndo())
\r
24 assert(not aSession.canRedo())
\r
27 assert(aDoc.size("Construction") == 7)
\r
28 assert(not aSession.canUndo())
\r
29 assert(aSession.canRedo())
\r
32 assert(aDoc.size("Construction") == 8)
\r
33 assert(aSession.canUndo())
\r
34 assert(not aSession.canRedo())
\r