Salome HOME
a6633a4d58b53595c77633a508d9b732d0c9f44d
[modules/shaper.git] / src / ModelHighAPI / Test / Test19990_1.py
1 # Copyright (C) 2020-2023  CEA/DEN, EDF R&D
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 from salome.shaper import model
21
22 model.begin()
23 partSet = model.moduleDocument()
24
25 ### Create Part
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
28
29 ### Create Sketch
30 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
31
32 ### Create SketchArc
33 SketchArc_1 = Sketch_1.addArc(56.24665913968287, -62.02452773486242, 35.57563613077872, -17.19150878248001, 88.70981046865168, -24.82997724138561, False)
34
35 ### Create SketchLine
36 SketchLine_1 = Sketch_1.addLine(88.70981046865168, -24.82997724138561, 35.57563613077872, -17.19150878248001)
37 Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
38 Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
39 model.do()
40
41 ### Create Extrusion
42 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", (56.24665913968287, -64.29248088508524, 0))], model.selection(), 50, 0)
43
44 ### Create Sketch
45 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", (56.24665913968287, -64.29248088508524, 50)))
46
47 ### Create SketchProjection
48 SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", (56.24665913968287, -62.02452773486242, 50)), False)
49 SketchPoint_1 = SketchProjection_1.createdFeature()
50
51 ### Create SketchArc
52 SketchArc_2 = Sketch_2.addArc(56.24665913968287, -62.02452773486242, 45.34418302532956, -36.70999577489869, 82.89389484228845, -54.98078276603709, False)
53 Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_2.center())
54
55 ### Create SketchLine
56 SketchLine_2 = Sketch_2.addLine(82.89389484228843, -54.98078276603709, 45.34418302532956, -36.70999577489869)
57 Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint())
58 Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_2.endPoint())
59 model.do()
60
61 ### Create ExtrusionCut
62 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", (64.11903893380899, -45.84538927046789, 50))], model.selection(), 0, 10, [model.selection("SOLID", (55.99758335516852, -63.75630399502394, 25))])
63
64 model.end()
65
66 from GeomAPI import *
67
68 model.testNbResults(ExtrusionCut_1, 1)
69 model.testNbSubResults(ExtrusionCut_1, [0])
70 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [1])
71 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [7])
72 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [24])
73 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [48])
74 model.testResultsVolumes(ExtrusionCut_1, [347314.47596])
75
76 assert(model.checkPythonDump())