Salome HOME
Updated copyright comment
[modules/shaper.git] / src / FiltersPlugin / Test / TestFilter_EdgeSize.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 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 = "EdgeSize", args = [ "inf" , 60.0 ])])
34
35 model.end()
36 Reference = {
37     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"): True,
38     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"): True,
39     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"): True,
40     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"): True,
41     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"): False,
42     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"): False,
43     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"): False,
44     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"): False,
45     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): False,
46     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): False,
47     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): False,
48     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False}
49
50 model.checkFilter(Part_1_doc, model, Filters, Reference)
51
52 model.begin()
53 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "sup" , 60.0 ])])
54 model.end()
55
56 Reference = {
57     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"): False,
58     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"): False,
59     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"): False,
60     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"): False,
61     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"): True,
62     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"): True,
63     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"): True,
64     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"): True,
65     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): True,
66     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): True,
67     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): True,
68     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True}
69
70 model.checkFilter(Part_1_doc, model, Filters, Reference)
71
72 model.begin()
73 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "inf" , 50.0 ])])
74 model.end()
75
76 Reference = {
77     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"): False,
78     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"): False,
79     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"): False,
80     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"): False,
81     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"): False,
82     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"): False,
83     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"): False,
84     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"): False,
85     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): False,
86     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): False,
87     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): False,
88     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False}
89
90 model.checkFilter(Part_1_doc, model, Filters, Reference)
91
92 model.begin()
93 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "infEq" , 50.0 ])])
94 model.end()
95
96 Reference = {
97     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"): True,
98     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"): True,
99     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"): True,
100     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"): True,
101     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"): False,
102     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"): False,
103     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"): False,
104     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"): False,
105     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): False,
106     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): False,
107     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): False,
108     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): False}
109
110 model.checkFilter(Part_1_doc, model, Filters, Reference)
111
112 model.begin()
113 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "supEq" , 50.0 ])])
114 model.end()
115
116 Reference = {
117     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"): True,
118     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"): True,
119     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"): True,
120     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"): True,
121     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"): True,
122     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"): True,
123     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"): True,
124     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"): True,
125     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): True,
126     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): True,
127     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): True,
128     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True}
129
130 model.checkFilter(Part_1_doc, model, Filters, Reference)
131
132 model.begin()
133 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "isBetween" , 50.0 , 200.0])])
134 model.end()
135
136 Reference = {
137     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"): True,
138     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"): True,
139     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"): True,
140     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"): True,
141     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"): True,
142     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"): True,
143     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"): True,
144     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"): True,
145     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): True,
146     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): True,
147     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): True,
148     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True}
149
150 model.checkFilter(Part_1_doc, model, Filters, Reference)
151
152 model.begin()
153 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "isStrictlyBetween" , 50.0 , 200.0])])
154 model.end()
155
156 Reference = {
157     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"): False,
158     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"): False,
159     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"): False,
160     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"): False,
161     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"): True,
162     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"): True,
163     model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"): True,
164     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"): True,
165     model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"): True,
166     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"): True,
167     model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"): True,
168     model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"): True}
169
170 model.checkFilter(Part_1_doc, model, Filters, Reference)