Salome HOME
Issue #803: Put all the python modules in the same python package newgeom
[modules/shaper.git] / src / FeaturesPlugin / Test / TestRecover.py
1 # Test made with high level API
2 # -----------------------------
3
4 from salome.shaper import model
5
6 # Initialisation
7
8 model.begin()
9 mypartset = model.moduleDocument()
10
11
12 # Creating a new Part, two circles, extrusions on them and Boolean CUT
13
14 mypart = model.addPart(mypartset).document()
15
16 sk1 = model.addSketch(mypart, model.defaultPlane("XOY"))
17 c1 = sk1.addCircle(0, 0, 100)
18 model.do()
19 bigcyl = model.addExtrusion(mypart, sk1.selectFace(), 100)
20
21 sk2 = model.addSketch(mypart, model.defaultPlane("XOY"))
22 c2 = sk2.addCircle(20, 30, 30)
23 model.do()
24 smallcyl = model.addExtrusion(mypart, sk2.selectFace(), 150)
25
26 cut = model.addCut(mypart, bigcyl.results(), smallcyl.results())
27
28 model.do()
29
30 # check bodies number is 1: only Boolean result
31 assert(mypart.size("Bodies") == 1)
32
33 model.addRecover(mypart, cut, smallcyl.results())
34
35 model.end()
36
37 # check that one is recovered
38 assert(mypart.size("Bodies") == 2)
39
40 model.undo()
41
42 # check bodies number is 1: recover is canceled
43 assert(mypart.size("Bodies") == 1)
44
45
46 # check persistent flag of recover: never concealed
47 model.begin()
48 recover = model.addRecover(mypart, cut, smallcyl.results())
49 model.end()
50
51 assert(mypart.size("Bodies") == 2)
52
53 model.begin()
54 sk3 = model.addSketch(mypart, model.defaultPlane("XOY"))
55 c3 = sk3.addCircle(0, 0, 90)
56 model.do()
57 big2 = model.addExtrusion(mypart, sk3.selectFace(), 110)
58
59 cut2 = model.addCut(mypart, big2.results(), smallcyl.results())
60
61 model.end()
62
63 # two booleans and small cylinder
64 assert(mypart.size("Bodies") == 3)
65
66 assert(model.checkPythonDump())