From 8cb8992a16319fa5ce66d73e4f5ab93691bbb8a4 Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 31 Jul 2019 11:16:13 +0300 Subject: [PATCH] Change "On geometry" filter to process geometrically identical shapes instead of checking the same geometrical base. --- src/FiltersPlugin/CMakeLists.txt | 14 +- .../FiltersPlugin_OnGeometry.cpp | 4 +- ...Edge.py => TestFilter_OnGeometry_Edge1.py} | 1 + .../Test/TestFilter_OnGeometry_Edge2.py | 166 ++++++++++++++++++ ...=> TestFilter_OnGeometry_Exclude_Edge1.py} | 1 + .../TestFilter_OnGeometry_Exclude_Edge2.py | 166 ++++++++++++++++++ ...=> TestFilter_OnGeometry_Exclude_Face1.py} | 8 +- .../TestFilter_OnGeometry_Exclude_Face2.py | 106 +++++++++++ .../TestFilter_OnGeometry_Exclude_Face3.py | 106 +++++++++++ ...Face.py => TestFilter_OnGeometry_Face1.py} | 8 +- .../Test/TestFilter_OnGeometry_Face2.py | 106 +++++++++++ .../Test/TestFilter_OnGeometry_Face3.py | 106 +++++++++++ src/GeomAPI/GeomAPI_Cylinder.cpp | 23 +++ src/GeomAPI/GeomAPI_Cylinder.h | 4 + src/GeomAPI/GeomAPI_Edge.cpp | 26 ++- src/GeomAPI/GeomAPI_Face.cpp | 68 ++++++- 16 files changed, 895 insertions(+), 18 deletions(-) rename src/FiltersPlugin/Test/{TestFilter_OnGeometry_Edge.py => TestFilter_OnGeometry_Edge1.py} (99%) create mode 100644 src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py rename src/FiltersPlugin/Test/{TestFilter_OnGeometry_Exclude_Edge.py => TestFilter_OnGeometry_Exclude_Edge1.py} (99%) create mode 100644 src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py rename src/FiltersPlugin/Test/{TestFilter_OnGeometry_Exclude_Face.py => TestFilter_OnGeometry_Exclude_Face1.py} (93%) create mode 100644 src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py create mode 100644 src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py rename src/FiltersPlugin/Test/{TestFilter_OnGeometry_Face.py => TestFilter_OnGeometry_Face1.py} (93%) create mode 100644 src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py create mode 100644 src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py diff --git a/src/FiltersPlugin/CMakeLists.txt b/src/FiltersPlugin/CMakeLists.txt index 62482f88e..c90061fef 100644 --- a/src/FiltersPlugin/CMakeLists.txt +++ b/src/FiltersPlugin/CMakeLists.txt @@ -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 diff --git a/src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp b/src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp index c7fa73d32..aeeb67650 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnGeometry.cpp @@ -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_Edge1.py similarity index 99% rename from src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge.py rename to src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py index 7a14e68c4..368a57918 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge1.py @@ -96,6 +96,7 @@ 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(): diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py new file mode 100644 index 000000000..36cf0b6be --- /dev/null +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Edge2.py @@ -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_Edge1.py similarity index 99% rename from src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge.py rename to src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py index a06b537aa..287317a83 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge1.py @@ -96,6 +96,7 @@ 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(): diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py new file mode 100644 index 000000000..1bb20d920 --- /dev/null +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Edge2.py @@ -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_Face1.py similarity index 93% rename from src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face.py rename to src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py index d4a5b62f5..5f519a0fe 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face1.py @@ -49,12 +49,14 @@ 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) -while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = True - exp.next() +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(): diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py new file mode 100644 index 000000000..5f1eff72f --- /dev/null +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face2.py @@ -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 index 000000000..8c73804de --- /dev/null +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Exclude_Face3.py @@ -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_Face1.py similarity index 93% rename from src/FiltersPlugin/Test/TestFilter_OnGeometry_Face.py rename to src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py index 1638b0b0e..6e6cb326c 100644 --- a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face.py +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face1.py @@ -49,12 +49,14 @@ 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) -while exp.more(): - Reference[model.selection(ResultCylinder_1, exp.current())] = False - exp.next() +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(): diff --git a/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py new file mode 100644 index 000000000..56ba0b4cc --- /dev/null +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face2.py @@ -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 index 000000000..d002114ef --- /dev/null +++ b/src/FiltersPlugin/Test/TestFilter_OnGeometry_Face3.py @@ -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) diff --git a/src/GeomAPI/GeomAPI_Cylinder.cpp b/src/GeomAPI/GeomAPI_Cylinder.cpp index 35b23e73b..87fab54e5 100644 --- a/src/GeomAPI/GeomAPI_Cylinder.cpp +++ b/src/GeomAPI/GeomAPI_Cylinder.cpp @@ -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(); + 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; +} diff --git a/src/GeomAPI/GeomAPI_Cylinder.h b/src/GeomAPI/GeomAPI_Cylinder.h index da78aeb36..0bb627ef6 100644 --- a/src/GeomAPI/GeomAPI_Cylinder.h +++ b/src/GeomAPI/GeomAPI_Cylinder.h @@ -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 theCylinder, + const double theTolerance = 1.e-7); + private: double myHeight; }; diff --git a/src/GeomAPI/GeomAPI_Edge.cpp b/src/GeomAPI/GeomAPI_Edge.cpp index f939e6559..830fbb1b1 100644 --- a/src/GeomAPI/GeomAPI_Edge.cpp +++ b/src/GeomAPI/GeomAPI_Edge.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -68,17 +69,34 @@ GeomAPI_Edge::GeomAPI_Edge(const std::shared_ptr& 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 theShape) const { if (!theShape->isEdge()) return false; + if (isSame(theShape)) + return true; + TopoDS_Edge anOwnEdge = TopoDS::Edge(impl()); TopoDS_Edge anOtherEdge = TopoDS::Edge(theShape->impl()); - 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 diff --git a/src/GeomAPI/GeomAPI_Face.cpp b/src/GeomAPI/GeomAPI_Face.cpp index c03ec7f23..bb907330c 100644 --- a/src/GeomAPI/GeomAPI_Face.cpp +++ b/src/GeomAPI/GeomAPI_Face.cpp @@ -32,13 +32,17 @@ #include #include #include +#include #include #include #include #include #include +#include #include +#include #include +#include #include #include #include @@ -104,16 +108,74 @@ bool GeomAPI_Face::isEqual(std::shared_ptr 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 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_Face anOtherFace = TopoDS::Face(theShape->impl()); - 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 -- 2.30.2