Salome HOME
Fix for the unit tests due to names changing in issue #2375
[modules/shaper.git] / src / FeaturesPlugin / Test / Test2197_4.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 # revolution of 4-edges contour (5th is used as axis of rotation) is checking for naming of edges
22
23 from salome.shaper import model
24
25 model.begin()
26 partSet = model.moduleDocument()
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
29 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
30 SketchLine_1 = Sketch_1.addLine(138.1074168797953, 47.3145780051151, 265.9846547314579, 35.80562659846547)
31 SketchLine_2 = Sketch_1.addLine(248.0818414322251, 186.7007672634271, 138.1074168797954, 234.0153452685422)
32 SketchLine_2.setName("SketchLine_3")
33 SketchLine_2.result().setName("SketchLine_3")
34 SketchLine_3 = Sketch_1.addLine(138.1074168797954, 234.0153452685422, 138.1074168797953, 47.3145780051151)
35 SketchLine_3.setName("SketchLine_4")
36 SketchLine_3.result().setName("SketchLine_4")
37 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
38 SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_3")
39 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
40 SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4")
41 SketchLine_4 = Sketch_1.addLine(248.0818414322251, 186.7007672634271, 215.8394027534853, 111.2328618876045)
42 SketchLine_4.setName("SketchLine_5")
43 SketchLine_4.result().setName("SketchLine_5")
44 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_4.startPoint())
45 SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
46 SketchLine_5 = Sketch_1.addLine(215.8394027534853, 111.2328618876045, 265.9846547314579, 35.80562659846547)
47 SketchLine_5.setName("SketchLine_6")
48 SketchLine_5.result().setName("SketchLine_6")
49 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
50 SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
51 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.endPoint())
52 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
53 model.do()
54 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5r-SketchLine_6r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), 360, 0)
55 Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&Revolution_1_1/Generated_Face_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_3&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Revolution_1_1/Base_Edge_4"), model.selection("EDGE", "Revolution_1_1/Base_Edge_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Revolution_1_1/Generated_Face_3")])
56 model.end()
57
58 # check that resulting group selection is valid
59 from ModelAPI import *
60 aFactory = ModelAPI_Session.get().validators()
61 assert(aFactory.validate(Group_1.feature()))
62 assert(Group_1.groupList().size() == 7)
63 for a in range(7):
64   assert(Group_1.groupList().value(a).value().shapeTypeStr() == "EDGE")
65   assert(len(Group_1.groupList().value(a).namingName()) > 0)
66
67 assert(model.checkPythonDump())