Salome HOME
Merge branch 'V9_9_BR'
[modules/shaper.git] / src / BuildPlugin / Test / Test20513_1.py
1 # Copyright (C) 2020-2022  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 SketchAPI import *
21
22 from salome.shaper import model
23
24 model.begin()
25 partSet = model.moduleDocument()
26
27 ### Create Part
28 Part_1 = model.addPart(partSet)
29 Part_1_doc = Part_1.document()
30
31 ### Create Sketch
32 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
33
34 ### Create SketchProjection
35 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
36 SketchPoint_1 = SketchProjection_1.createdFeature()
37
38 ### Create SketchBSpline
39 SketchBSpline_1_poles = [(0, 0),
40                          (64.69989977297864, 3.820449445888325),
41                          (63.227018959685, 42.02181716036146),
42                          (19.7442263567145, 66.94290132940253),
43                          (0, 0)
44                         ]
45 SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles)
46 [SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6] = SketchBSpline_1.controlPoles(auxiliary = [0, 1, 2, 3, 4])
47 [SketchLine_1, SketchLine_2, SketchLine_3, SketchLine_4] = SketchBSpline_1.controlPolygon(auxiliary = [0, 1, 2, 3])
48 Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchPoint_1.result())
49 Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_6).coordinates(), SketchPoint_1.result())
50 model.do()
51
52 ### Create Plane
53 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchBSpline_1f"), 10, False)
54
55 ### Create Sketch
56 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
57
58 ### Create SketchProjection
59 SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
60 SketchPoint_7 = SketchProjection_2.createdFeature()
61
62 ### Create SketchBSpline
63 SketchBSpline_2_poles = [(0, 0),
64                          (8.839087148173476, 45.21301708610518),
65                          (53.18579907801947, 39.22586299994072),
66                          (47.99568029170977, 4.506542817571567),
67                          (0, 0)
68                         ]
69 SketchBSpline_2 = Sketch_2.addSpline(poles = SketchBSpline_2_poles)
70 [SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12] = SketchBSpline_2.controlPoles(auxiliary = [0, 1, 2, 3, 4])
71 [SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchBSpline_2.controlPolygon(auxiliary = [0, 1, 2, 3])
72 Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_8).coordinates(), SketchPoint_7.result())
73 Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_12).coordinates(), SketchPoint_7.result())
74 model.do()
75
76 ### Create Wire
77 Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchBSpline_1")], False)
78
79 ### Create Wire
80 Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchBSpline_2")], False)
81
82 ### Create Filling
83 Filling_1 = model.addFilling(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
84
85 model.end()
86
87 from GeomAPI import *
88
89 model.testNbResults(Filling_1, 1)
90 model.testNbSubResults(Filling_1, [0])
91 model.testNbSubShapes(Filling_1, GeomAPI_Shape.SOLID, [0])
92 model.testNbSubShapes(Filling_1, GeomAPI_Shape.FACE, [1])
93 model.testNbSubShapes(Filling_1, GeomAPI_Shape.EDGE, [4])
94 model.testNbSubShapes(Filling_1, GeomAPI_Shape.VERTEX, [8])
95 model.testResultsAreas(Filling_1, [1872.0403629667237])
96
97 assert(model.checkPythonDump())