From 0325db75534c99a962d6c03f2619e1fcc04491b6 Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 2 Nov 2018 15:11:37 +0300 Subject: [PATCH] Issue #2716: no check that subshapes of the same shape are used for common Now common allow selection of sub-shapes of the same shape in simple mode. --- src/FeaturesPlugin/CMakeLists.txt | 1 + .../FeaturesPlugin_BooleanCommon.cpp | 3 ++- src/FeaturesPlugin/Test/Test2617.py | 27 +++++++++++++++++++ src/FeaturesPlugin/Test/Test2692.py | 2 ++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/FeaturesPlugin/Test/Test2617.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 9ab857eef..83646b745 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -386,4 +386,5 @@ ADD_UNIT_TESTS(TestExtrusion.py Test2701.py Test2724.py Test2692.py + Test2617.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp index d52e23146..539724c33 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.cpp @@ -78,7 +78,8 @@ void FeaturesPlugin_BooleanCommon::execute() } ResultPtr aContext = anObjectAttr->context(); ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext); - if (aResCompSolidPtr.get()) + if (!isSimpleMode + && aResCompSolidPtr.get()) { std::shared_ptr aContextShape = aResCompSolidPtr->shape(); GeomAPI_Shape::ShapeType aShapeType = aResCompSolidPtr->shape()->shapeType(); diff --git a/src/FeaturesPlugin/Test/Test2617.py b/src/FeaturesPlugin/Test/Test2617.py new file mode 100644 index 000000000..0e50b6d42 --- /dev/null +++ b/src/FeaturesPlugin/Test/Test2617.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "PartSet/OX"), 5) +Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), True) +Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_2"), model.selection("SOLID", "Symmetry_1_1_1")]) +model.do() +model.testHaveNamingSubshapes(Common_1, model, Part_1_doc) +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Common_1, 1) +model.testNbSubResults(Common_1, [0]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [3]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8]) +model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16]) +model.testResultsVolumes(Common_1, [461.055845803990962394891539589]) + +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/Test2692.py b/src/FeaturesPlugin/Test/Test2692.py index ac516381b..d7dff2aba 100644 --- a/src/FeaturesPlugin/Test/Test2692.py +++ b/src/FeaturesPlugin/Test/Test2692.py @@ -28,3 +28,5 @@ model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [21]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [90]) model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [180]) model.testResultsVolumes(ExtrusionCut_1, [2347.550996571865198347950354218]) + +assert(model.checkPythonDump()) -- 2.39.2