Salome HOME
Correct order of sub-shapes in the intersection and neighbor names, as it is in the...
[modules/shaper.git] / src / FeaturesPlugin / Test / Test1816.py
1 ## Copyright (C) 2014-2017  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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 # The test for correct selection of a whole feautre as argument of other feature: select all extrusions
22 # produced from the scetch, then change the number of sketch contours, so, anytway all extrusions must
23 # still be selected in the Cut Boolean oepration
24
25 from salome.shaper import model
26
27 model.begin()
28 partSet = model.moduleDocument()
29 Part_1 = model.addPart(partSet)
30 Part_1_doc = Part_1.document()
31 model.addParameter(Part_1_doc, "Ray", "12.5")
32 model.addParameter(Part_1_doc, "Lgx", "50")
33 model.addParameter(Part_1_doc, "Lgy", "60")
34 model.addParameter(Part_1_doc, "Lgz", "75")
35 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
36 SketchLine_1 = Sketch_1.addLine(0, 0, 0, 75)
37 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
38 SketchPoint_1 = SketchProjection_1.createdFeature()
39 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
40 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
41 SketchLine_2 = SketchProjection_2.createdFeature()
42 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result())
43 SketchLine_3 = Sketch_1.addLine(0, 75, 37.5, 75)
44 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
45 SketchArc_1 = Sketch_1.addArc(37.5, 62.5, 37.5, 75, 50, 62.5, True)
46 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint())
47 SketchLine_4 = Sketch_1.addLine(50, 62.5, 50, 0)
48 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint())
49 SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
50 SketchLine_5 = SketchProjection_3.createdFeature()
51 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.result())
52 SketchLine_6 = Sketch_1.addLine(50, 0, 0, 0)
53 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint())
54 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint())
55 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result())
56 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
57 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1])
58 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_1.results()[1])
59 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Lgz")
60 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), "Lgx")
61 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "Ray")
62 model.do()
63 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchArc_1_2f-SketchLine_3r-SketchLine_1r")], model.selection(), 0, "Lgy")
64 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
65 SketchLine_7 = Sketch_2.addLine(0, -75, 0, 0)
66 SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
67 SketchPoint_2 = SketchProjection_4.createdFeature()
68 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchPoint_2.result())
69 SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), False)
70 SketchPoint_3 = SketchProjection_5.createdFeature()
71 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_3.result())
72 SketchLine_8 = Sketch_2.addLine(0, 0, 60, 0)
73 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
74 SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), False)
75 SketchPoint_4 = SketchProjection_6.createdFeature()
76 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchPoint_4.result())
77 SketchLine_9 = Sketch_2.addLine(60, 0, 59.99999999999999, -62.5)
78 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
79 SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), False)
80 SketchLine_10 = SketchProjection_7.createdFeature()
81 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.result())
82 SketchLine_11 = Sketch_2.addLine(0, -75, 47.49999999999999, -75)
83 SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_11.startPoint())
84 SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False)
85 SketchLine_12 = SketchProjection_8.createdFeature()
86 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result())
87 SketchArc_2 = Sketch_2.addArc(47.49999999999999, -62.5, 59.99999999999999, -62.5, 47.49999999999999, -75, True)
88 SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchArc_2.startPoint())
89 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], "Ray")
90 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_11.endPoint())
91 SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_11.result())
92 SketchConstraintTangent_4 = Sketch_2.setTangent(SketchLine_9.result(), SketchArc_2.results()[1])
93 model.do()
94 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchArc_2_2f-SketchLine_9r-SketchLine_8r-SketchLine_7r")], model.selection(), 0, "Lgx")
95 Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
96 model.do()
97 model.end()
98
99 assert(len(Common_1.results()) == 1)
100 model.testResultsVolumes(Common_1, [221498.777690970688126981258392334])
101
102 assert(model.checkPythonDump())