]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Change "On geometry" filter to process geometrically identical shapes instead of...
authorazv <azv@opencascade.com>
Wed, 31 Jul 2019 08:16:13 +0000 (11:16 +0300)
committerazv <azv@opencascade.com>
Wed, 31 Jul 2019 08:16:51 +0000 (11:16 +0300)
20 files changed:
src/FiltersPlugin/CMakeLists.txt
src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp
src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge.py [deleted file]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge.py [deleted file]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face.py [deleted file]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Face.py [deleted file]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py [new file with mode: 0644]
src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py [new file with mode: 0644]
src/GeomAPI/GeomAPI_Cylinder.cpp
src/GeomAPI/GeomAPI_Cylinder.h
src/GeomAPI/GeomAPI_Edge.cpp
src/GeomAPI/GeomAPI_Face.cpp

index 62482f88e1991fa410e9a9c8890e2d52d9eb4f1e..c90061fef0720a127492f9fae8903e6d208e4e16 100644 (file)
@@ -114,10 +114,16 @@ ADD_UNIT_TESTS(
   TestFilter_OnPlane_Exclude.py
   TestFilter_OnLine.py
   TestFilter_OnLine_Exclude.py
-  TestFilter_OnGeometry_Edge.py
-  TestFilter_OnGeometry_Face.py
-  TestFilter_OnGeometry_Exclude_Edge.py
-  TestFilter_OnGeometry_Exclude_Face.py
+  TestFilter_OnGeometry_Edge1.py
+  TestFilter_OnGeometry_Edge2.py
+  TestFilter_OnGeometry_Face1.py
+  TestFilter_OnGeometry_Face2.py
+  TestFilter_OnGeometry_Face3.py
+  TestFilter_OnGeometry_Exclude_Edge1.py
+  TestFilter_OnGeometry_Exclude_Edge2.py
+  TestFilter_OnGeometry_Exclude_Face1.py
+  TestFilter_OnGeometry_Exclude_Face2.py
+  TestFilter_OnGeometry_Exclude_Face3.py
   TestFilter_OnPlaneSide_Face.py
   TestFilter_OnPlaneSide_Plane.py
   TestFilter_OnPlaneSide_Exclude_Face.py
index c7fa73d32aa2516a475566fe54ffa27a892928af..aeeb676504db8f944fb90adeb9342a6cee0dcb7d 100644 (file)
@@ -37,7 +37,9 @@ bool FiltersPlugin_OnGeometry::isOk(const GeomShapePtr& theShape, const ResultPt
   for (int i = 0; i < aList->size(); i++) {
     AttributeSelectionPtr aAttr = aList->value(i);
     GeomShapePtr aGeom = aAttr->value();
-    if (aGeom->isSameGeometry(theShape))
+    if (!aGeom)
+      aGeom = aAttr->context()->shape();
+    if (aGeom && aGeom->isSameGeometry(theShape))
       return true;
   }
   return false;
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge.py
deleted file mode 100644 (file)
index 7a14e68..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-from salome.shaper import model
-from GeomAPI import *
-
-model.begin()
-partSet = model.moduleDocument()
-Part_1 = model.addPart(partSet)
-Part_1_doc = Part_1.document()
-Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right"))
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], 20190506)
-Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20)
-FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]")])])
-model.end()
-
-Reference = {}
-# Faces of the box
-ResultBox_1 = Partition_1.result().resultSubShapePair()[0]
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE)
-while exp.more():
-  Reference[model.selection(ResultBox_1, exp.current())] = False
-  exp.next()
-# Faces of the cylinder
-ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0]
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = False
-  exp.next()
-# Edges of the original box (selected as a sub-shapes of the result to keep original surface).
-# Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes.
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE)
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-# Edges of the cylinder
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = False
-  exp.next()
-# Vertices of the original box
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX)
-while exp.more():
-  Reference[model.selection(ResultBox_1, exp.current())] = False
-  exp.next()
-# Vertices of the cylinder
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = False
-  exp.next()
-
-model.checkFilter(Part_1_doc, model, FilterFace, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py
new file mode 100644 (file)
index 0000000..368a579
--- /dev/null
@@ -0,0 +1,116 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right"))
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], 20190506)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20)
+FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]")])])
+model.end()
+
+Reference = {}
+# Faces of the box
+ResultBox_1 = Partition_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE)
+while exp.more():
+  Reference[model.selection(ResultBox_1, exp.current())] = False
+  exp.next()
+# Faces of the cylinder
+ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = False
+  exp.next()
+# Edges of the original box (selected as a sub-shapes of the result to keep original surface).
+# Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes.
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE)
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+assert(not exp.more())
+# Edges of the cylinder
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = False
+  exp.next()
+# Vertices of the original box
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX)
+while exp.more():
+  Reference[model.selection(ResultBox_1, exp.current())] = False
+  exp.next()
+# Vertices of the cylinder
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = False
+  exp.next()
+
+model.checkFilter(Part_1_doc, model, FilterFace, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py
new file mode 100644 (file)
index 0000000..36cf0b6
--- /dev/null
@@ -0,0 +1,166 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0)
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 80)
+SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
+SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80)
+Extrusion_1.setNestedSketch(Sketch_1)
+model.do()
+Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/To_Face]")])])
+model.end()
+
+Reference = {}
+# Extrusion Solid 1
+ResultExtrusion = Extrusion_1.result().subResult(0).resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE)
+# edges of face 1
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 2
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 3
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 4
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 5
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 6
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+assert(not exp.more())
+
+# Extrusion Solid 2
+ResultExtrusion = Extrusion_1.result().subResult(1).resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE)
+# edges of face 1
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 2
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 3
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 4
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 5
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+assert(not exp.more())
+
+# Extrusion Solid 3
+ResultExtrusion = Extrusion_1.result().subResult(2).resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE)
+# edges of face 1
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 2
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 3
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 4
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 5
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+assert(not exp.more())
+
+# Extrusion Solid 4
+ResultExtrusion = Extrusion_1.result().subResult(3).resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE)
+# edges of face 1
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 2
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 3
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 4
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 5
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+assert(not exp.more())
+
+model.checkFilter(Part_1_doc, model, Filters, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge.py
deleted file mode 100644 (file)
index a06b537..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-from salome.shaper import model
-from GeomAPI import *
-
-model.begin()
-partSet = model.moduleDocument()
-Part_1 = model.addPart(partSet)
-Part_1_doc = Part_1.document()
-Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right"))
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], 20190506)
-Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20)
-FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]")])])
-model.end()
-
-Reference = {}
-# Faces of the box
-ResultBox_1 = Partition_1.result().resultSubShapePair()[0]
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE)
-while exp.more():
-  Reference[model.selection(ResultBox_1, exp.current())] = True
-  exp.next()
-# Faces of the cylinder
-ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0]
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = True
-  exp.next()
-# Edges of the original box (selected as a sub-shapes of the result to keep original surface).
-# Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes.
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE)
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-# Edges of the cylinder
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = True
-  exp.next()
-# Vertices of the original box
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX)
-while exp.more():
-  Reference[model.selection(ResultBox_1, exp.current())] = True
-  exp.next()
-# Vertices of the cylinder
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = True
-  exp.next()
-
-model.checkFilter(Part_1_doc, model, FilterFace, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py
new file mode 100644 (file)
index 0000000..287317a
--- /dev/null
@@ -0,0 +1,116 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right"))
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], 20190506)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20)
+FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("EDGE", "Partition_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Front"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Box_1_1/Front]")])])
+model.end()
+
+Reference = {}
+# Faces of the box
+ResultBox_1 = Partition_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE)
+while exp.more():
+  Reference[model.selection(ResultBox_1, exp.current())] = True
+  exp.next()
+# Faces of the cylinder
+ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = True
+  exp.next()
+# Edges of the original box (selected as a sub-shapes of the result to keep original surface).
+# Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes.
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE)
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+assert(not exp.more())
+# Edges of the cylinder
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = True
+  exp.next()
+# Vertices of the original box
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX)
+while exp.more():
+  Reference[model.selection(ResultBox_1, exp.current())] = True
+  exp.next()
+# Vertices of the cylinder
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = True
+  exp.next()
+
+model.checkFilter(Part_1_doc, model, FilterFace, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py
new file mode 100644 (file)
index 0000000..1bb20d9
--- /dev/null
@@ -0,0 +1,166 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0)
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 80)
+SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
+SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80)
+Extrusion_1.setNestedSketch(Sketch_1)
+model.do()
+Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_3/To_Face]")])])
+model.end()
+
+Reference = {}
+# Extrusion Solid 1
+ResultExtrusion = Extrusion_1.result().subResult(0).resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE)
+# edges of face 1
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 2
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 3
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 4
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 5
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 6
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+assert(not exp.more())
+
+# Extrusion Solid 2
+ResultExtrusion = Extrusion_1.result().subResult(1).resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE)
+# edges of face 1
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 2
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 3
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 4
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 5
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+assert(not exp.more())
+
+# Extrusion Solid 3
+ResultExtrusion = Extrusion_1.result().subResult(2).resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE)
+# edges of face 1
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 2
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 3
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 4
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 5
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+assert(not exp.more())
+
+# Extrusion Solid 4
+ResultExtrusion = Extrusion_1.result().subResult(3).resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.EDGE)
+# edges of face 1
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# edges of face 2
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 3
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 4
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# edges of face 5
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+assert(not exp.more())
+
+model.checkFilter(Part_1_doc, model, Filters, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face.py
deleted file mode 100644 (file)
index d4a5b62..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-from salome.shaper import model
-from GeomAPI import *
-
-model.begin()
-partSet = model.moduleDocument()
-Part_1 = model.addPart(partSet)
-Part_1_doc = Part_1.document()
-Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right"))
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], 20190506)
-Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20)
-FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top")])])
-model.end()
-
-Reference = {}
-# Faces of the box (selected as a sub-shapes of the result to keep original surface).
-# Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes.
-ResultBox_1 = Partition_1.result().resultSubShapePair()[0]
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE)
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-# Faces of the cylinder
-ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0]
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = True
-  exp.next()
-# Edges of the original box
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE)
-while exp.more():
-  Reference[model.selection(ResultBox_1, exp.current())] = True
-  exp.next()
-# Edges of the cylinder
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = True
-  exp.next()
-# Vertices of the original box
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX)
-while exp.more():
-  Reference[model.selection(ResultBox_1, exp.current())] = True
-  exp.next()
-# Vertices of the cylinder
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = True
-  exp.next()
-
-model.checkFilter(Part_1_doc, model, FilterFace, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py
new file mode 100644 (file)
index 0000000..5f519a0
--- /dev/null
@@ -0,0 +1,81 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right"))
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], 20190506)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20)
+FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top")])])
+model.end()
+
+Reference = {}
+# Faces of the box (selected as a sub-shapes of the result to keep original surface).
+# Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes.
+ResultBox_1 = Partition_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE)
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+assert(not exp.more())
+# Faces of the cylinder
+ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE)
+Reference[model.selection(ResultCylinder_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultCylinder_1, exp.current())] = True;  exp.next()
+assert(not exp.more())
+# Edges of the original box
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE)
+while exp.more():
+  Reference[model.selection(ResultBox_1, exp.current())] = True
+  exp.next()
+# Edges of the cylinder
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = True
+  exp.next()
+# Vertices of the original box
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX)
+while exp.more():
+  Reference[model.selection(ResultBox_1, exp.current())] = True
+  exp.next()
+# Vertices of the cylinder
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = True
+  exp.next()
+
+model.checkFilter(Part_1_doc, model, FilterFace, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py
new file mode 100644 (file)
index 0000000..5f1eff7
--- /dev/null
@@ -0,0 +1,106 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0)
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 80)
+SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
+SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80)
+Extrusion_1.setNestedSketch(Sketch_1)
+Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_3 = Sketch_2.addLine(80, -20, 20, -20)
+SketchLine_4 = Sketch_2.addLine(20, -20, 20, -100)
+SketchLine_5 = Sketch_2.addLine(20, -100, 80, -100)
+SketchLine_6 = Sketch_2.addLine(80, -100, 80, -20)
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result())
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True)
+SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True)
+SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True)
+Revolution_1.setNestedSketch(Sketch_2)
+model.do()
+Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2")])])
+model.end()
+
+Reference = {}
+# Extrusion
+ResultExtrusion = Extrusion_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.FACE)
+# faces of solid 1
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# faces of solid 2
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# faces of solid 3
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# faces of solid 4
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# Revolution
+ResultRevolution = Revolution_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE)
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+
+model.checkFilter(Part_1_doc, model, Filters, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py
new file mode 100644 (file)
index 0000000..8c73804
--- /dev/null
@@ -0,0 +1,106 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0)
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 80)
+SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
+SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80)
+Extrusion_1.setNestedSketch(Sketch_1)
+Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_3 = Sketch_2.addLine(80, -20, 20, -20)
+SketchLine_4 = Sketch_2.addLine(20, -20, 20, -100)
+SketchLine_5 = Sketch_2.addLine(20, -100, 80, -100)
+SketchLine_6 = Sketch_2.addLine(80, -100, 80, -20)
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result())
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True)
+SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True)
+SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True)
+Revolution_1.setNestedSketch(Sketch_2)
+model.do()
+Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", exclude = True, args = [model.selection("FACE", "Extrusion_1_1_3/To_Face")])])
+model.end()
+
+Reference = {}
+# Extrusion
+ResultExtrusion = Extrusion_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.FACE)
+# faces of solid 1
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# faces of solid 2
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# faces of solid 3
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# faces of solid 4
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# Revolution
+ResultRevolution = Revolution_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE)
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+
+model.checkFilter(Part_1_doc, model, Filters, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face.py
deleted file mode 100644 (file)
index 1638b0b..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-from salome.shaper import model
-from GeomAPI import *
-
-model.begin()
-partSet = model.moduleDocument()
-Part_1 = model.addPart(partSet)
-Part_1_doc = Part_1.document()
-Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right"))
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], 20190506)
-Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20)
-FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top")])])
-model.end()
-
-Reference = {}
-# Faces of the box (selected as a sub-shapes of the result to keep original surface).
-# Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes.
-ResultBox_1 = Partition_1.result().resultSubShapePair()[0]
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE)
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
-# Faces of the cylinder
-ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0]
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = False
-  exp.next()
-# Edges of the original box
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE)
-while exp.more():
-  Reference[model.selection(ResultBox_1, exp.current())] = False
-  exp.next()
-# Edges of the cylinder
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = False
-  exp.next()
-# Vertices of the original box
-exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX)
-while exp.more():
-  Reference[model.selection(ResultBox_1, exp.current())] = False
-  exp.next()
-# Vertices of the cylinder
-exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX)
-while exp.more():
-  Reference[model.selection(ResultCylinder_1, exp.current())] = False
-  exp.next()
-
-model.checkFilter(Part_1_doc, model, FilterFace, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py
new file mode 100644 (file)
index 0000000..6e6cb32
--- /dev/null
@@ -0,0 +1,81 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Right"))
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")], 20190506)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), 20)
+FilterFace = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Top")])])
+model.end()
+
+Reference = {}
+# Faces of the box (selected as a sub-shapes of the result to keep original surface).
+# Note: the expected values have to be updated if ShapeExplorer will return another order of sub-shapes.
+ResultBox_1 = Partition_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.FACE)
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultBox_1, exp.current())] = False; exp.next()
+assert(not exp.more())
+# Faces of the cylinder
+ResultCylinder_1 = Translation_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.FACE)
+Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next()
+Reference[model.selection(ResultCylinder_1, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultCylinder_1, exp.current())] = False; exp.next()
+assert(not exp.more())
+# Edges of the original box
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.EDGE)
+while exp.more():
+  Reference[model.selection(ResultBox_1, exp.current())] = False
+  exp.next()
+# Edges of the cylinder
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.EDGE)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = False
+  exp.next()
+# Vertices of the original box
+exp = GeomAPI_ShapeExplorer(ResultBox_1.shape(), GeomAPI_Shape.VERTEX)
+while exp.more():
+  Reference[model.selection(ResultBox_1, exp.current())] = False
+  exp.next()
+# Vertices of the cylinder
+exp = GeomAPI_ShapeExplorer(ResultCylinder_1.shape(), GeomAPI_Shape.VERTEX)
+while exp.more():
+  Reference[model.selection(ResultCylinder_1, exp.current())] = False
+  exp.next()
+
+model.checkFilter(Part_1_doc, model, FilterFace, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py
new file mode 100644 (file)
index 0000000..56ba0b4
--- /dev/null
@@ -0,0 +1,106 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0)
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 80)
+SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
+SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80)
+Extrusion_1.setNestedSketch(Sketch_1)
+Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_3 = Sketch_2.addLine(80, -20, 20, -20)
+SketchLine_4 = Sketch_2.addLine(20, -20, 20, -100)
+SketchLine_5 = Sketch_2.addLine(20, -100, 80, -100)
+SketchLine_6 = Sketch_2.addLine(80, -100, 80, -20)
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result())
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True)
+SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True)
+SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True)
+Revolution_1.setNestedSketch(Sketch_2)
+model.do()
+Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2")])])
+model.end()
+
+Reference = {}
+# Extrusion
+ResultExtrusion = Extrusion_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.FACE)
+# faces of solid 1
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# faces of solid 2
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# faces of solid 3
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# faces of solid 4
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+# Revolution
+ResultRevolution = Revolution_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE)
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = True;  exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+
+model.checkFilter(Part_1_doc, model, Filters, Reference)
diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py
new file mode 100644 (file)
index 0000000..d002114
--- /dev/null
@@ -0,0 +1,106 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 100, 0)
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 80)
+SketchLine_1 = Sketch_1.addLine(-70.03988514133886, -38.65765757761403, 65.03214823048954, -46.59205615260649)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
+SketchLine_2 = Sketch_1.addLine(6.89273184263731, -79.70251092497334, 48.24895637932232, 63.81252391424628)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 80)
+Extrusion_1.setNestedSketch(Sketch_1)
+Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 270, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_3 = Sketch_2.addLine(80, -20, 20, -20)
+SketchLine_4 = Sketch_2.addLine(20, -20, 20, -100)
+SketchLine_5 = Sketch_2.addLine(20, -100, 80, -100)
+SketchLine_6 = Sketch_2.addLine(80, -100, 80, -20)
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result())
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 80, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 20, True)
+SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_3.result(), 20, True)
+SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_5.result(), 100, True)
+Revolution_1.setNestedSketch(Sketch_2)
+model.do()
+Filters = model.filters(Part_1_doc, [model.addFilter(name = "OnGeometry", args = [model.selection("FACE", "Extrusion_1_1_3/To_Face")])])
+model.end()
+
+Reference = {}
+# Extrusion
+ResultExtrusion = Extrusion_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultExtrusion.shape(), GeomAPI_Shape.FACE)
+# faces of solid 1
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# faces of solid 2
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# faces of solid 3
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# faces of solid 4
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = False; exp.next()
+Reference[model.selection(ResultExtrusion, exp.current())] = True;  exp.next()
+# Revolution
+ResultRevolution = Revolution_1.result().resultSubShapePair()[0]
+exp = GeomAPI_ShapeExplorer(ResultRevolution.shape(), GeomAPI_Shape.FACE)
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+Reference[model.selection(ResultRevolution, exp.current())] = False; exp.next()
+
+model.checkFilter(Part_1_doc, model, Filters, Reference)
index 35b23e73bf922061f6f45107cd16cec9bb337242..87fab54e588871c98307e582e3ce87b7679b02fa 100644 (file)
@@ -81,3 +81,26 @@ bool GeomAPI_Cylinder::isInfinite() const
 {
   return Precision::IsInfinite(myHeight);
 }
+
+//=================================================================================================
+bool GeomAPI_Cylinder::isCoincident(const GeomCylinderPtr theCylinder, const double theTolerance)
+{
+  if (!theCylinder)
+    return false;
+
+  gp_Cylinder* anOther = theCylinder->implPtr<gp_Cylinder>();
+  if (fabs(MY_CYL->Radius() - anOther->Radius()) < theTolerance) {
+    gp_Dir aDir1 = MY_CYL->Position().Direction();
+    gp_Dir aDir2 = anOther->Position().Direction();
+    if (aDir1.IsParallel(aDir2, Precision::Angular())) {
+      gp_Pnt aLoc1 = MY_CYL->Location();
+      gp_Pnt aLoc2 = anOther->Location();
+      gp_Vec aVec12(aLoc1, aLoc2);
+      if (aVec12.SquareMagnitude() < theTolerance * theTolerance ||
+          aVec12.IsParallel(aDir1, Precision::Angular())) {
+        return true;
+      }
+    }
+  }
+  return false;
+}
index da78aeb36a87e889be33b5e10a84d2b4baec434a..0bb627ef6206a4da912c8f75c6df7f9f9b085176 100644 (file)
@@ -59,6 +59,10 @@ public:
   /// Return \c true is the cylinder is infinite
   GEOMAPI_EXPORT bool isInfinite() const;
 
+  /// Returns true if cylinders have same axis and radii.
+  GEOMAPI_EXPORT bool isCoincident(const std::shared_ptr<GeomAPI_Cylinder> theCylinder,
+                                   const double theTolerance = 1.e-7);
+
 private:
   double myHeight;
 };
index f939e6559e4c3e7b722326e95c7e71aa6b22e2cb..830fbb1b1ceac2fa867ea85ac0b3011820cc7814 100644 (file)
@@ -41,6 +41,7 @@
 #include <Geom_TrimmedCurve.hxx>
 #include <Geom_Ellipse.hxx>
 #include <Geom_Plane.hxx>
+#include <GeomAPI_ExtremaCurveCurve.hxx>
 #include <GeomAPI_ExtremaCurveSurface.hxx>
 #include <GeomAPI_IntCS.hxx>
 #include <GeomAdaptor_Curve.hxx>
@@ -68,17 +69,34 @@ GeomAPI_Edge::GeomAPI_Edge(const std::shared_ptr<GeomAPI_Shape>& theShape)
   }
 }
 
+static Handle(Geom_Curve) baseCurve(const TopoDS_Edge& theEdge)
+{
+  double aFirst, aLast;
+  Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast);
+  while (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
+    Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(aCurve);
+    aCurve = tc->BasisCurve();
+  }
+  return aCurve;
+}
+
 bool GeomAPI_Edge::isSameGeometry(const std::shared_ptr<GeomAPI_Shape> theShape) const
 {
   if (!theShape->isEdge())
     return false;
+  if (isSame(theShape))
+    return true;
+
   TopoDS_Edge anOwnEdge = TopoDS::Edge(impl<TopoDS_Shape>());
   TopoDS_Edge anOtherEdge = TopoDS::Edge(theShape->impl<TopoDS_Shape>());
 
-  double aFirst, aLast;
-  Handle(Geom_Curve) anOwnCurve = BRep_Tool::Curve(anOwnEdge, aFirst, aLast);
-  Handle(Geom_Curve) anOtherCurve = BRep_Tool::Curve(anOtherEdge, aFirst, aLast);
-  return anOwnCurve == anOtherCurve;
+  Handle(Geom_Curve) anOwnCurve = baseCurve(anOwnEdge);
+  Handle(Geom_Curve) anOtherCurve = baseCurve(anOtherEdge);
+  GeomAPI_ExtremaCurveCurve anExtrema(anOwnCurve, anOtherCurve);
+
+  bool isSame = anExtrema.Extrema().IsParallel() &&
+                anExtrema.TotalLowerDistance() < Precision::Confusion();
+  return isSame;
 }
 
 bool GeomAPI_Edge::isLine() const
index c03ec7f23313092e4c01a181333a6ffab1492ca2..bb907330c08eb1fd1b2ccea4d2451a8ad2865d99 100644 (file)
 #include <BRepAdaptor_Surface.hxx>
 #include <BRepGProp_Face.hxx>
 #include <BRepTools.hxx>
+#include <BRepTopAdaptor_TopolTool.hxx>
 #include <Geom_Surface.hxx>
 #include <Geom_SphericalSurface.hxx>
 #include <Geom_ConicalSurface.hxx>
 #include <Geom_CylindricalSurface.hxx>
 #include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_SweptSurface.hxx>
 #include <Geom_ToroidalSurface.hxx>
+#include <GeomAdaptor_HSurface.hxx>
 #include <GeomLib_IsPlanarSurface.hxx>
+#include <IntPatch_ImpImpIntersection.hxx>
 #include <IntTools_Context.hxx>
 #include <Standard_Type.hxx>
 #include <TopoDS.hxx>
@@ -104,16 +108,74 @@ bool GeomAPI_Face::isEqual(std::shared_ptr<GeomAPI_Shape> theFace) const
   return aRes == Standard_True;
 }
 
+static Handle(Geom_Surface) baseSurface(const TopoDS_Face& theFace)
+{
+  Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
+  while (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
+    Handle(Geom_RectangularTrimmedSurface) rts =
+        Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf);
+    aSurf = rts->BasisSurface();
+  }
+  return aSurf;
+}
+
 bool GeomAPI_Face::isSameGeometry(const std::shared_ptr<GeomAPI_Shape> theShape) const
 {
   if (!theShape->isFace())
     return false;
+  if (isSame(theShape))
+    return true;
+
+  GeomFacePtr anOther = theShape->face();
+  if (isPlanar() && anOther->isPlanar()) {
+    GeomPlanePtr anOwnPlane = getPlane();
+    GeomPlanePtr anOtherPlane = anOther->getPlane();
+    return anOwnPlane->isCoincident(anOtherPlane);
+  }
+
   TopoDS_Face anOwnFace = TopoDS::Face(impl<TopoDS_Shape>());
   TopoDS_Face anOtherFace = TopoDS::Face(theShape->impl<TopoDS_Shape>());
 
-  Handle(Geom_Surface) anOwnSurf = BRep_Tool::Surface(anOwnFace);
-  Handle(Geom_Surface) anOtherSurf = BRep_Tool::Surface(anOtherFace);
-  return anOwnSurf == anOtherSurf;
+  Handle(Geom_Surface) anOwnSurf = baseSurface(anOwnFace);
+  Handle(Geom_Surface) anOtherSurf = baseSurface(anOtherFace);
+
+  // case of two elementary surfaces
+  if (anOwnSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) &&
+      anOtherSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
+  {
+    Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(anOwnSurf);
+    Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(anOtherSurf);
+
+    Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool();
+    Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool();
+
+    try {
+      IntPatch_ImpImpIntersection anIIInt(aGA1, aTT1, aGA2, aTT2,
+                                          Precision::Confusion(),
+                                          Precision::Confusion());
+      if (!anIIInt.IsDone() || anIIInt.IsEmpty())
+        return false;
+
+      return anIIInt.TangentFaces();
+    }
+    catch (Standard_Failure const&) {
+      return false;
+    }
+  }
+
+  // case of two cylindrical surfaces, at least one of which is a swept surface
+  // swept surfaces: SurfaceOfLinearExtrusion, SurfaceOfRevolution
+  if ((anOwnSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
+       anOwnSurf->IsKind(STANDARD_TYPE(Geom_SweptSurface))) &&
+      (anOtherSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
+       anOtherSurf->IsKind(STANDARD_TYPE(Geom_SweptSurface))))
+  {
+    GeomCylinderPtr anOwnCyl = getCylinder();
+    GeomCylinderPtr anOtherCyl = anOther->getCylinder();
+    return anOwnCyl && anOtherCyl && anOwnCyl->isCoincident(anOtherCyl);
+  }
+
+  return false;
 }
 
 bool GeomAPI_Face::isCylindrical() const