From 891f27dcbee0b2666893ffa9a883b730840d50da Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 21 Aug 2019 15:22:32 +0300 Subject: [PATCH] Avoid solids to be a result of "In/On/Out a solid" filter (issue #2953) --- .../FiltersPlugin_RelativeToSolid.cpp | 2 +- .../TestFilter_RelativeToSolid_Exclude_In.py | 18 ------------------ ...stFilter_RelativeToSolid_Exclude_InAndOn.py | 18 ------------------ ...TestFilter_RelativeToSolid_Exclude_NotOn.py | 18 ------------------ .../TestFilter_RelativeToSolid_Exclude_On.py | 18 ------------------ .../TestFilter_RelativeToSolid_Exclude_Out.py | 18 ------------------ ...tFilter_RelativeToSolid_Exclude_OutAndOn.py | 18 ------------------ .../Test/TestFilter_RelativeToSolid_In.py | 18 ------------------ .../Test/TestFilter_RelativeToSolid_InAndOn.py | 18 ------------------ .../Test/TestFilter_RelativeToSolid_NotOn.py | 18 ------------------ .../Test/TestFilter_RelativeToSolid_On.py | 18 ------------------ .../Test/TestFilter_RelativeToSolid_Out.py | 18 ------------------ .../TestFilter_RelativeToSolid_OutAndOn.py | 18 ------------------ .../Test/TestFilters_Supported.py | 2 +- 14 files changed, 2 insertions(+), 218 deletions(-) diff --git a/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.cpp b/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.cpp index 3a0a76cd4..e3be677e2 100644 --- a/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.cpp +++ b/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.cpp @@ -29,7 +29,7 @@ bool FiltersPlugin_RelativeToSolid::isSupported(GeomAPI_Shape::ShapeType theType) const { - return true; + return theType >= GeomAPI_Shape::SHELL; } bool FiltersPlugin_RelativeToSolid::isOk(const GeomShapePtr& theShape, const ResultPtr&, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_In.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_In.py index 34ac97fc2..6ca93c92a 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_In.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_In.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "in"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): True, - model.selection(Solid2, emptyShape): True, - model.selection(Solid3, emptyShape): True, - model.selection(Solid4, emptyShape): True, - model.selection(Solid5, emptyShape): False, - model.selection(Solid6, emptyShape): True, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): True, model.selection("FACE", "Extrusion_1_1/From_Face"): True, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_InAndOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_InAndOn.py index dd44bef5f..b1753228b 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_InAndOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_InAndOn.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "not_out"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): False, - model.selection(Solid2, emptyShape): True, - model.selection(Solid3, emptyShape): True, - model.selection(Solid4, emptyShape): False, - model.selection(Solid5, emptyShape): False, - model.selection(Solid6, emptyShape): True, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_NotOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_NotOn.py index 63154f145..7d66cf27e 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_NotOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_NotOn.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "not_on"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): True, - model.selection(Solid2, emptyShape): False, - model.selection(Solid3, emptyShape): True, - model.selection(Solid4, emptyShape): True, - model.selection(Solid5, emptyShape): False, - model.selection(Solid6, emptyShape): True, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): True, model.selection("FACE", "Extrusion_1_1/From_Face"): True, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_On.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_On.py index 7dd9283ac..841c693cc 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_On.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_On.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "on"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): True, - model.selection(Solid2, emptyShape): True, - model.selection(Solid3, emptyShape): True, - model.selection(Solid4, emptyShape): True, - model.selection(Solid5, emptyShape): True, - model.selection(Solid6, emptyShape): True, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_Out.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_Out.py index 66cc31f06..ff2ae3001 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_Out.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_Out.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "out"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): True, - model.selection(Solid2, emptyShape): False, - model.selection(Solid3, emptyShape): True, - model.selection(Solid4, emptyShape): True, - model.selection(Solid5, emptyShape): True, - model.selection(Solid6, emptyShape): True, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): True, model.selection("FACE", "Extrusion_1_1/From_Face"): True, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_OutAndOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_OutAndOn.py index f63183c47..81d78595a 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_OutAndOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Exclude_OutAndOn.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", exclude = True, args = [model.selection("SOLID", "Extrusion_1_1"), "not_in"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): True, - model.selection(Solid2, emptyShape): False, - model.selection(Solid3, emptyShape): False, - model.selection(Solid4, emptyShape): True, - model.selection(Solid5, emptyShape): True, - model.selection(Solid6, emptyShape): True, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_In.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_In.py index 69937f82c..9ff836284 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_In.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_In.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "in"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): False, - model.selection(Solid2, emptyShape): False, - model.selection(Solid3, emptyShape): False, - model.selection(Solid4, emptyShape): False, - model.selection(Solid5, emptyShape): True, - model.selection(Solid6, emptyShape): False, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_InAndOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_InAndOn.py index c3247dee6..09fafe4fe 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_InAndOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_InAndOn.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "not_out"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): True, - model.selection(Solid2, emptyShape): False, - model.selection(Solid3, emptyShape): False, - model.selection(Solid4, emptyShape): True, - model.selection(Solid5, emptyShape): True, - model.selection(Solid6, emptyShape): False, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): True, model.selection("FACE", "Extrusion_1_1/From_Face"): True, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_NotOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_NotOn.py index 4c82e357b..276da9622 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_NotOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_NotOn.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "not_on"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): False, - model.selection(Solid2, emptyShape): True, - model.selection(Solid3, emptyShape): False, - model.selection(Solid4, emptyShape): False, - model.selection(Solid5, emptyShape): True, - model.selection(Solid6, emptyShape): False, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_On.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_On.py index aa57cfe4d..24cabe3a0 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_On.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_On.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "on"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): False, - model.selection(Solid2, emptyShape): False, - model.selection(Solid3, emptyShape): False, - model.selection(Solid4, emptyShape): False, - model.selection(Solid5, emptyShape): False, - model.selection(Solid6, emptyShape): False, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): True, model.selection("FACE", "Extrusion_1_1/From_Face"): True, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Out.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Out.py index eeb33a2bd..480c4f8b7 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Out.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_Out.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "out"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): False, - model.selection(Solid2, emptyShape): True, - model.selection(Solid3, emptyShape): False, - model.selection(Solid4, emptyShape): False, - model.selection(Solid5, emptyShape): False, - model.selection(Solid6, emptyShape): False, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): False, model.selection("FACE", "Extrusion_1_1/From_Face"): False, diff --git a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_OutAndOn.py b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_OutAndOn.py index 6154daae8..f12d335d2 100644 --- a/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_OutAndOn.py +++ b/src/FiltersPlugin/Test/TestFilter_RelativeToSolid_OutAndOn.py @@ -76,25 +76,7 @@ Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cyli Filters = model.filters(Part_1_doc, [model.addFilter(name = "RelativeToSolid", args = [model.selection("SOLID", "Extrusion_1_1"), "not_in"])]) model.end() -Solid1 = Extrusion_1.results()[0].resultSubShapePair()[0] -Solid2 = Extrusion_1.results()[1].resultSubShapePair()[0] -Solid3 = Extrusion_2.result().resultSubShapePair()[0] -Solid4 = Extrusion_3.result().resultSubShapePair()[0] -Solid5 = Extrusion_4.result().resultSubShapePair()[0] -Solid6 = Translation_1.result().resultSubShapePair()[0] - -from GeomAPI import GeomAPI_Shape -emptyShape = GeomAPI_Shape() - Reference = { - # Solids - model.selection(Solid1, emptyShape): False, - model.selection(Solid2, emptyShape): True, - model.selection(Solid3, emptyShape): True, - model.selection(Solid4, emptyShape): False, - model.selection(Solid5, emptyShape): False, - model.selection(Solid6, emptyShape): False, - # Faces of solid 1 model.selection("FACE", "Extrusion_1_1/To_Face"): True, model.selection("FACE", "Extrusion_1_1/From_Face"): True, diff --git a/src/FiltersPlugin/Test/TestFilters_Supported.py b/src/FiltersPlugin/Test/TestFilters_Supported.py index 418a68707..2eb7ffb65 100644 --- a/src/FiltersPlugin/Test/TestFilters_Supported.py +++ b/src/FiltersPlugin/Test/TestFilters_Supported.py @@ -42,7 +42,7 @@ Reference = { GeomAPI_Shape.WIRE : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID], GeomAPI_Shape.FACE : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_GEOMETRY, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID, FILTER_EXTERNAL_FACES, FILTER_HORIZONTAL_FACES, FILTER_VERTICAL_FACES, FILTER_CONNECTED_FACES], GeomAPI_Shape.SHELL : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID], - GeomAPI_Shape.SOLID : [FILTER_BELONGS_TO, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID], + GeomAPI_Shape.SOLID : [FILTER_BELONGS_TO, FILTER_ON_PLANE_SIDE], } model.begin() -- 2.39.2