Salome HOME
5d017a75ef6e2040f0ec49d2ecfb6dfbcf0c19f2
[modules/shaper.git] / src / FiltersPlugin / Test / TestFilter_OnGeometry_Exclude_Face4.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 from GeomAPI import *
22
23 model.begin()
24 partSet = model.moduleDocument()
25 Part_1 = model.addPart(partSet)
26 Part_1_doc = Part_1.document()
27 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 45)
28 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_4"))
29 SketchArc_1 = Sketch_1.addArc(2.402631123626777, 4.538350751693263, 2.946623076146047, 2.768866376496988, 3.159520035183744, 6.227765257973941, False)
30 model.do()
31 Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")])
32 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 0, 90)
33 FiltersCyl = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Cylinder_1_1/Face_1")])])
34 FiltersRev = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Revolution_1_1")])])
35 model.end()
36
37 Reference = {}
38 ResultRevolution = Revolution_1.result().resultSubShapePair()[0]
39 exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE)
40 Reference[model.selection(ResultRevolution, exp.current())] = True; exp.next()
41 assert(not exp.more())
42
43 model.checkFilter(Part_1_doc, model, FiltersCyl, Reference)
44
45 Reference = {}
46 ResultCylinder = Cylinder_1.result().resultSubShapePair()[0]
47 exp = GeomAPI_ShapeExplorer(ResultCylinder.shape(), GeomAPI_Shape.FACE)
48 while exp.more():
49   Reference[model.selection(ResultCylinder, exp.current())] = True
50   exp.next()
51
52 model.checkFilter(Part_1_doc, model, FiltersRev, Reference)