1 ## Copyright (C) 2014-2017 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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 # Test made with high level API
22 # -----------------------------
24 from salome.shaper import model
29 mypartset = model.moduleDocument()
32 # Creating a new Part, two circles, extrusions on them and Boolean CUT
34 mypart = model.addPart(mypartset).document()
36 sk1 = model.addSketch(mypart, model.defaultPlane("XOY"))
37 c1 = sk1.addCircle(0, 0, 100)
39 bigcyl = model.addExtrusion(mypart, sk1.selectFace(), 100)
41 sk2 = model.addSketch(mypart, model.defaultPlane("XOY"))
42 c2 = sk2.addCircle(20, 30, 30)
44 smallcyl = model.addExtrusion(mypart, sk2.selectFace(), 150)
46 cut = model.addCut(mypart, bigcyl.results(), smallcyl.results())
50 # check bodies number is 1: only Boolean result
51 assert(mypart.size("Bodies") == 1)
53 model.addRecover(mypart, cut, smallcyl.results())
57 # check that one is recovered
58 assert(mypart.size("Bodies") == 2)
62 # check bodies number is 1: recover is canceled
63 assert(mypart.size("Bodies") == 1)
66 # check persistent flag of recover: never concealed
68 recover = model.addRecover(mypart, cut, smallcyl.results())
71 assert(mypart.size("Bodies") == 2)
74 sk3 = model.addSketch(mypart, model.defaultPlane("XOY"))
75 c3 = sk3.addCircle(0, 0, 90)
77 big2 = model.addExtrusion(mypart, sk3.selectFace(), 110)
79 cut2 = model.addCut(mypart, big2.results(), smallcyl.results())
83 # two booleans and small cylinder
84 assert(mypart.size("Bodies") == 3)
86 assert(model.checkPythonDump())