1 # Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # Test made with high level API
21 # -----------------------------
23 from salome.shaper import model
28 mypartset = model.moduleDocument()
31 # Creating a new Part, two circles, extrusions on them and Boolean CUT
33 mypart = model.addPart(mypartset).document()
35 sk1 = model.addSketch(mypart, model.defaultPlane("XOY"))
36 c1 = sk1.addCircle(0, 0, 100)
38 bigcyl = model.addExtrusion(mypart, sk1.selectFace(), 100)
40 sk2 = model.addSketch(mypart, model.defaultPlane("XOY"))
41 c2 = sk2.addCircle(20, 30, 30)
43 smallcyl = model.addExtrusion(mypart, sk2.selectFace(), 150)
45 cut = model.addCut(mypart, bigcyl.results(), smallcyl.results())
49 # check bodies number is 1: only Boolean result
50 assert(mypart.size("Bodies") == 1)
52 model.addRecover(mypart, cut, smallcyl.results())
56 # check that one is recovered
57 assert(mypart.size("Bodies") == 2)
61 # check bodies number is 1: recover is canceled
62 assert(mypart.size("Bodies") == 1)
65 # check persistent flag of recover: never concealed
67 recover = model.addRecover(mypart, cut, smallcyl.results())
70 assert(mypart.size("Bodies") == 2)
73 sk3 = model.addSketch(mypart, model.defaultPlane("XOY"))
74 c3 = sk3.addCircle(0, 0, 90)
76 big2 = model.addExtrusion(mypart, sk3.selectFace(), 110)
78 smallcyl2 = model.addExtrusion(mypart, sk2.selectFace(), 150)
79 cut2 = model.addCut(mypart, big2.results(), smallcyl2.results())
83 # two booleans and small cylinder
84 assert(mypart.size("Bodies") == 3)
86 assert(model.checkPythonDump())