From 0a09316f2ca476696536a6f71b763a80719fe064 Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 28 Mar 2017 14:25:30 +0300 Subject: [PATCH] Issue #2046: Naming incorrect after an extrusion of a wire. Fixed naming faces for extrusion of wire. --- src/FeaturesPlugin/CMakeLists.txt | 1 + .../FeaturesPlugin_CompositeSketch.cpp | 7 +++-- src/FeaturesPlugin/Test/Test2046.py | 28 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/FeaturesPlugin/Test/Test2046.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 1214c5890..5b4e12997 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -147,4 +147,5 @@ ADD_UNIT_TESTS(TestExtrusion.py Test1942.py Test1915.py Test2023.py + Test2046.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index 06320e03c..6556b2f46 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -278,7 +278,10 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes std::shared_ptr aMapOfSubShapes = theMakeShape->mapOfSubShapes(); switch(aBaseShapeType) { - case GeomAPI_Shape::EDGE: + case GeomAPI_Shape::EDGE: { + aShapeTypeToExplode = GeomAPI_Shape::VERTEX; + break; + } case GeomAPI_Shape::WIRE: { //std::shared_ptr aV1, aV2; //GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2); @@ -291,7 +294,7 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes //if(!aV2History.empty()) { // theResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2", theTag++); //} - aShapeTypeToExplode = GeomAPI_Shape::VERTEX; + aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; break; } case GeomAPI_Shape::FACE: diff --git a/src/FeaturesPlugin/Test/Test2046.py b/src/FeaturesPlugin/Test/Test2046.py new file mode 100644 index 000000000..48590c8eb --- /dev/null +++ b/src/FeaturesPlugin/Test/Test2046.py @@ -0,0 +1,28 @@ +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(-1154.716981132076, -199.5283018867925, -849.0566037735849, 128.7735849056603) +SketchLine_2 = Sketch_1.addLine(-849.0566037735849, 128.7735849056603, -563.2075471698113, -69.33962264150945) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(-563.2075471698113, -69.33962264150945, -70.75471698113215, 326.8867924528301) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +model.do() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_3")]) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0) +Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1")]) +model.do() +model.end() + +groupFeature = Group_1.feature() +groupSelectionList = groupFeature.selectionList("group_list") +assert(groupSelectionList.size() == 3) +for index in range(0, groupSelectionList.size()): + attrSelection = groupSelectionList.value(index) + shape = attrSelection.value() + name = attrSelection.namingName() + assert(shape.isFace()) + assert(name != ""), "Empty shape name" -- 2.39.2