Salome HOME
updated copyright message
[modules/shaper.git] / src / FiltersPlugin / Test / TestFilter_VerticalFaces_Exclude.py
1 # Copyright (C) 2014-2023  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 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
27 LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 20, 2, model.selection("EDGE", "PartSet/OY"), 20, 3)
28 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
29 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
30 Filters = model.filters(Part_1_doc, [model.addFilter(name = "VerticalFaces", exclude = True)])
31 model.end()
32
33 Reference = {
34     # Faces of the original box
35     model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Top"): True,
36     model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom"): True,
37     model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Front"): False,
38     model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Back"): False,
39     model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Right"): False,
40     model.selection("FACE", "LinearCopy_1_1_1/MF:Translated&Box_1_1/Left"): False,
41     # Translated box
42     model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Top"): True,
43     model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Bottom"): True,
44     model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Front"): False,
45     model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Back"): False,
46     model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Right"): False,
47     model.selection("FACE", "LinearCopy_1_1_2/MF:Translated&Box_1_1/Left"): False,
48     # Box translated along another direction
49     model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Top"): True,
50     model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Bottom"): True,
51     model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Front"): False,
52     model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Back"): False,
53     model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Right"): False,
54     model.selection("FACE", "LinearCopy_1_1_3/MF:Translated&Box_1_1/Left"): False,
55     # Faces of the cylinder
56     model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_1"): False,
57     model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_2"): True,
58     model.selection("FACE", "Translation_1_1/MF:Translated&Cylinder_1_1/Face_3"): True,
59     # Edges and vertices are not applicable
60     model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated&Box_1_1/Top]"): True,
61     model.selection("VERTEX", "[LinearCopy_1_1_1/MF:Translated&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated&Box_1_1/Bottom]"): True,
62     }
63 model.checkFilter(Part_1_doc, model, Filters, Reference)