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