Salome HOME
351bebad0f11b5cdf5b56d8e0bb66a97e280d39c
[modules/shaper.git] / src / FeaturesPlugin / Test / Test3139.py
1 # Copyright (C) 2020  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 Part_1 = model.addPart(partSet)
25 Part_1_doc = Part_1.document()
26 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
27 SketchLine_1 = Sketch_1.addLine(52.9121725731895, 8.799859429739596, 7.781201848998454, 8.799859429739596)
28 SketchLine_2 = Sketch_1.addLine(7.781201848998454, 8.799859429739596, 7.781201848998454, 36.33111129445148)
29 SketchLine_3 = Sketch_1.addLine(7.781201848998454, 36.33111129445148, 52.9121725731895, 36.33111129445148)
30 SketchLine_4 = Sketch_1.addLine(52.9121725731895, 36.33111129445148, 52.9121725731895, 8.799859429739596)
31 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
32 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
33 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
34 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
35 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
36 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
37 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
38 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
39 SketchLine_5 = Sketch_1.addLine(29.87981510015411, 36.33111129445148, 29.87981510015411, 8.799859429739596)
40 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result())
41 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result())
42 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result())
43 SketchCircle_1 = Sketch_1.addCircle(88.70570107858241, 30.96918335901386, 15.95582825781952)
44 model.do()
45 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0)
46 Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
47 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
48 SketchLine_6 = Sketch_2.addLine(91.78842679005474, 52.44197384283513, 18.42664179347724, 52.44197384283513)
49 SketchLine_7 = Sketch_2.addLine(18.42664179347724, 52.44197384283513, 18.42664179347724, 23.73518840939176)
50 SketchLine_8 = Sketch_2.addLine(18.42664179347724, 23.73518840939176, 91.78842679005474, 23.73518840939176)
51 SketchLine_9 = Sketch_2.addLine(91.78842679005474, 23.73518840939176, 91.78842679005474, 52.44197384283513)
52 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint())
53 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
54 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
55 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
56 SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result())
57 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_7.result())
58 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result())
59 SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_9.result())
60 model.do()
61 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection(), 10, 0)
62 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
63 model.do()
64
65 Part_2 = model.addPart(partSet)
66 Part_2_doc = Part_2.document()
67 Sketch_3 = model.addSketch(Part_2_doc, model.defaultPlane("XOY"))
68 SketchLine_10 = Sketch_3.addLine(52.9121725731895, 8.799859429739596, 7.781201848998454, 8.799859429739596)
69 SketchLine_11 = Sketch_3.addLine(7.781201848998454, 8.799859429739596, 7.781201848998454, 36.33111129445148)
70 SketchLine_12 = Sketch_3.addLine(7.781201848998454, 36.33111129445148, 52.9121725731895, 36.33111129445148)
71 SketchLine_13 = Sketch_3.addLine(52.9121725731895, 36.33111129445148, 52.9121725731895, 8.799859429739596)
72 SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_10.startPoint())
73 SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
74 SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
75 SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
76 SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_10.result())
77 SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_11.result())
78 SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_12.result())
79 SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_13.result())
80 SketchLine_14 = Sketch_3.addLine(29.87981510015411, 36.33111129445148, 29.87981510015411, 8.799859429739596)
81 SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_14.startPoint(), SketchLine_12.result())
82 SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_10.result())
83 SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_14.result())
84 SketchCircle_2 = Sketch_3.addCircle(88.70570107858241, 30.96918335901386, 15.95582825781952)
85 model.do()
86 Extrusion_3 = model.addExtrusion(Part_2_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 20, 0)
87 Compound_2 = model.addCompound(Part_2_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
88 Sketch_4 = model.addSketch(Part_2_doc, model.standardPlane("XOY"))
89 SketchLine_15 = Sketch_4.addLine(91.78842679005474, 52.44197384283513, 18.42664179347724, 52.44197384283513)
90 SketchLine_16 = Sketch_4.addLine(18.42664179347724, 52.44197384283513, 18.42664179347724, 23.73518840939176)
91 SketchLine_17 = Sketch_4.addLine(18.42664179347724, 23.73518840939176, 91.78842679005474, 23.73518840939176)
92 SketchLine_18 = Sketch_4.addLine(91.78842679005474, 23.73518840939176, 91.78842679005474, 52.44197384283513)
93 SketchConstraintCoincidence_17 = Sketch_4.setCoincident(SketchLine_18.endPoint(), SketchLine_15.startPoint())
94 SketchConstraintCoincidence_18 = Sketch_4.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
95 SketchConstraintCoincidence_19 = Sketch_4.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint())
96 SketchConstraintCoincidence_20 = Sketch_4.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
97 SketchConstraintHorizontal_7 = Sketch_4.setHorizontal(SketchLine_15.result())
98 SketchConstraintVertical_9 = Sketch_4.setVertical(SketchLine_16.result())
99 SketchConstraintHorizontal_8 = Sketch_4.setHorizontal(SketchLine_17.result())
100 SketchConstraintVertical_10 = Sketch_4.setVertical(SketchLine_18.result())
101 model.do()
102 Extrusion_4 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection(), 10, 0)
103 Cut_2 = model.addCut(Part_2_doc, [model.selection("SOLID", "Compound_1_1_1_1")], [model.selection("SOLID", "Extrusion_2_1")], keepSubResults = True)
104 model.do()
105
106 model.end()
107
108 from GeomAPI import *
109
110 model.testNbResults(Part_1, 1)
111 model.testNbSubResults(Part_1, [0])
112 model.testNbSubShapes(Part_1, GeomAPI_Shape.SOLID, [2])
113 model.testNbSubShapes(Part_1, GeomAPI_Shape.FACE, [16])
114 model.testNbSubShapes(Part_1, GeomAPI_Shape.EDGE, [74])
115 model.testNbSubShapes(Part_1, GeomAPI_Shape.VERTEX, [148])
116 model.testResultsVolumes(Part_1, [23407.60956])
117
118 model.testNbResults(Part_2, 1)
119 model.testNbSubResults(Part_2, [0])
120 model.testNbSubShapes(Part_2, GeomAPI_Shape.SOLID, [3])
121 model.testNbSubShapes(Part_2, GeomAPI_Shape.FACE, [19])
122 model.testNbSubShapes(Part_2, GeomAPI_Shape.EDGE, [80])
123 model.testNbSubShapes(Part_2, GeomAPI_Shape.VERTEX, [160])
124 model.testResultsVolumes(Part_2, [39403.873983562])