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.real("x").setValue(1.)
\r
12 aFeature.real("y").setValue(-1.)
\r
13 aFeature.real("z").setValue(0.)
\r
14 aFeatureName = aFeature.name()
\r
15 # "2" is because Origin is the first point
\r
16 assert(aFeatureName == "Point_2")
\r
19 aSession.finishOperation()
\r
21 assert(aDoc.size("Construction") == 8)
\r
22 assert(aSession.canUndo())
\r
23 assert(not aSession.canRedo())
\r
26 assert(aDoc.size("Construction") == 7)
\r
27 assert(not aSession.canUndo())
\r
28 assert(aSession.canRedo())
\r
31 assert(aDoc.size("Construction") == 8)
\r
32 assert(aSession.canUndo())
\r
33 assert(not aSession.canRedo())
\r