Salome HOME
19b9d0021a34ae84b083b370bc7675baa636d666
[modules/shaper.git] / src / FeaturesPlugin / Test / Test2692.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2018-2019  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 from salome.shaper import model
22
23 model.begin()
24 partSet = model.moduleDocument()
25 Part_1 = model.addPart(partSet)
26 Part_1_doc = Part_1.document()
27 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
28 LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 3)
29 ExtrusionCut_1_objects_2 = [model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "LinearCopy_1_1_3")]
30 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, ExtrusionCut_1_objects_2)
31 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top"))
32 SketchCircle_1 = Sketch_1.addCircle(4.871972805908816, 24.69028692663239, 2.754280056405151)
33 SketchCircle_2 = Sketch_1.addCircle(4.956613458332676, 4.459837610261877, 1.82794741094275)
34 SketchCircle_3 = Sketch_1.addCircle(4.842959508111481, 44.32940059836771, 3.136980464700132)
35 ExtrusionCut_1.setNestedSketch(Sketch_1)
36 model.do()
37 model.testHaveNamingSubshapes(ExtrusionCut_1, model, Part_1_doc)
38 model.end()
39
40 from GeomAPI import GeomAPI_Shape
41
42 model.testNbResults(ExtrusionCut_1, 1)
43 model.testNbSubResults(ExtrusionCut_1, [3])
44 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [3])
45 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [21])
46 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [90])
47 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [180])
48 model.testResultsVolumes(ExtrusionCut_1, [2347.550996571865198347950354218])
49
50 assert(model.checkPythonDump())