1 # Copyright (C) 2014-2022 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from salome.shaper import model
21 from SketchAPI import *
25 partSet = model.moduleDocument()
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
31 Box_1 = model.addBox(Part_1_doc, 100, 50, 100)
33 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "inf" , 60.0 ])])
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}
50 model.checkFilter(Part_1_doc, model, Filters, Reference)
53 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "sup" , 60.0 ])])
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}
70 model.checkFilter(Part_1_doc, model, Filters, Reference)
73 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "inf" , 50.0 ])])
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}
90 model.checkFilter(Part_1_doc, model, Filters, Reference)
93 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "infEq" , 50.0 ])])
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}
110 model.checkFilter(Part_1_doc, model, Filters, Reference)
113 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "supEq" , 50.0 ])])
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}
130 model.checkFilter(Part_1_doc, model, Filters, Reference)
133 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "isBetween" , 50.0 , 200.0])])
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}
150 model.checkFilter(Part_1_doc, model, Filters, Reference)
153 Filters = model.filters(Part_1_doc, [model.addFilter(name = "EdgeSize", args = [ "isStrictlyBetween" , 50.0 , 200.0])])
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}
170 model.checkFilter(Part_1_doc, model, Filters, Reference)