Salome HOME
updated copyright message
[modules/shaper.git] / src / FiltersPlugin / Test / TestFilter_FaceSize.py
1 # Copyright (C) 2014-2023  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 from salome.shaper import model
21 from SketchAPI import *
22 from GeomAPI import *
23
24 model.begin()
25 partSet = model.moduleDocument()
26 ### Create Part
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
29
30 ### Create Box
31 Box_1 = model.addBox(Part_1_doc, 100, 50, 100)
32
33 Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "inf" , 5000.0 ])])
34
35 model.end()
36 Reference = {
37     model.selection("FACE", "Box_1_1/Top"): False,
38     model.selection("FACE", "Box_1_1/Back"): False,
39     model.selection("FACE", "Box_1_1/Front"): False,
40     model.selection("FACE", "Box_1_1/Bottom"): False,
41     model.selection("FACE","Box_1_1/Right"): False,
42     model.selection("FACE","Box_1_1/Left"): False}
43
44 model.checkFilter(Part_1_doc, model, Filters, Reference)
45
46 model.begin()
47 Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "infEq" , 5000.0 ])])
48 model.end()
49
50 Reference = {
51     model.selection("FACE", "Box_1_1/Top"): True,
52     model.selection("FACE", "Box_1_1/Back"): True,
53     model.selection("FACE", "Box_1_1/Front"): True,
54     model.selection("FACE", "Box_1_1/Bottom"): True,
55     model.selection("FACE", "Box_1_1/Right"): False,
56     model.selection("FACE", "Box_1_1/Left"): False}
57
58 model.checkFilter(Part_1_doc, model, Filters, Reference)
59
60 model.begin()
61 Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "sup" , 5000.0 ])])
62 model.end()
63
64 Reference = {
65     model.selection("FACE", "Box_1_1/Top"): False,
66     model.selection("FACE", "Box_1_1/Back"): False,
67     model.selection("FACE", "Box_1_1/Front"): False,
68     model.selection("FACE", "Box_1_1/Bottom"): False,
69     model.selection("FACE", "Box_1_1/Right"): True,
70     model.selection("FACE", "Box_1_1/Left"): True}
71
72 model.checkFilter(Part_1_doc, model, Filters, Reference)
73
74 model.begin()
75 Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "inf" , 50.0 ])])
76 model.end()
77
78 Reference = {
79     model.selection("FACE", "Box_1_1/Top"): False,
80     model.selection("FACE", "Box_1_1/Back"): False,
81     model.selection("FACE", "Box_1_1/Front"): False,
82     model.selection("FACE", "Box_1_1/Bottom"): False,
83     model.selection("FACE", "Box_1_1/Right"): False,
84     model.selection("FACE", "Box_1_1/Left"): False}
85
86 model.checkFilter(Part_1_doc, model, Filters, Reference)
87
88 model.begin()
89 Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "supEq" , 5000.0 ])])
90 model.end()
91
92 Reference = {
93     model.selection("FACE", "Box_1_1/Top"): True,
94     model.selection("FACE", "Box_1_1/Back"): True,
95     model.selection("FACE", "Box_1_1/Front"): True,
96     model.selection("FACE", "Box_1_1/Bottom"): True,
97     model.selection("FACE", "Box_1_1/Right"): True,
98     model.selection("FACE", "Box_1_1/Left"): True}
99
100 model.checkFilter(Part_1_doc, model, Filters, Reference)
101
102 model.begin()
103 Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "supEq" , 7000.0 ])])
104 model.end()
105
106 Reference = {
107     model.selection("FACE", "Box_1_1/Top"): False,
108     model.selection("FACE", "Box_1_1/Back"): False,
109     model.selection("FACE", "Box_1_1/Front"): False,
110     model.selection("FACE", "Box_1_1/Bottom"): False,
111     model.selection("FACE", "Box_1_1/Right"): True,
112     model.selection("FACE", "Box_1_1/Left"): True}
113
114 model.checkFilter(Part_1_doc, model, Filters, Reference)
115
116 model.begin()
117 Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "isBetween" , 50.0 , 10000.0])])
118 model.end()
119
120 Reference = {
121     model.selection("FACE", "Box_1_1/Top"): True,
122     model.selection("FACE", "Box_1_1/Back"): True,
123     model.selection("FACE", "Box_1_1/Front"): True,
124     model.selection("FACE", "Box_1_1/Bottom"): True,
125     model.selection("FACE", "Box_1_1/Right"): True,
126     model.selection("FACE", "Box_1_1/Left"): True}
127
128 model.checkFilter(Part_1_doc, model, Filters, Reference)
129
130 model.begin()
131 Filters = model.filters(Part_1_doc, [model.addFilter(name = "FaceSize", args = [ "isStrictlyBetween" , 500.0 , 10000.0])])
132 model.end()
133
134 Reference = {
135     model.selection("FACE", "Box_1_1/Top"): True,
136     model.selection("FACE", "Box_1_1/Back"): True,
137     model.selection("FACE", "Box_1_1/Front"): True,
138     model.selection("FACE", "Box_1_1/Bottom"): True,
139     model.selection("FACE", "Box_1_1/Right"): False,
140     model.selection("FACE", "Box_1_1/Left"): False}
141
142 model.checkFilter(Part_1_doc, model, Filters, Reference)