From: mpv Date: Wed, 1 Nov 2017 11:30:22 +0000 (+0300) Subject: Fix for the correct selection shared faces of results of Partition (in case the share... X-Git-Tag: V_2.10.0RC~179 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fcc83a0255109d1fc94d9b2ef92af34523c9af5a;p=modules%2Fshaper.git Fix for the correct selection shared faces of results of Partition (in case the shared faces are produced by construction planes). The modification history must be located in both solids to avoid migration from one label to another and corruption of the topological naming selection mechanism. --- diff --git a/src/CollectionPlugin/Test/TestGroup1799.py b/src/CollectionPlugin/Test/TestGroup1799.py index 8a767c0e7..d048d7b4a 100644 --- a/src/CollectionPlugin/Test/TestGroup1799.py +++ b/src/CollectionPlugin/Test/TestGroup1799.py @@ -119,8 +119,8 @@ Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), 150, True) Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_7"), 150, True) Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_2")]) -Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_7/Modified_Face_1_3"), 110, True) -Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_5/Modified_Face_1_3"), 380, True) +Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_7/Modified_Face_2_4"), 110, True) +Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_3/Modified_Face_3_5"), 380, True) Partition_2 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_3"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("FACE", "Plane_4")]) model.do() diff --git a/src/FeaturesPlugin/Test/Test2240.py b/src/FeaturesPlugin/Test/Test2240.py index 5317ea29b..2c1821acc 100644 --- a/src/FeaturesPlugin/Test/Test2240.py +++ b/src/FeaturesPlugin/Test/Test2240.py @@ -106,7 +106,7 @@ Group_2.result().setName("acier") Group_2.result().setColor(170, 85, 0) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOY")) SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0) -SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "Partition_1_1_1/Modified_Edge_15_6&Partition_1_1_1/Modified_Edge_15_5")) +SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "Partition_1_1_1/Modified_Edge_15_18&Partition_1_1_1/Modified_Edge_15_17")) SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result()) SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10) SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10) diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index c1df33555..f66a6a1e6 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -408,7 +408,8 @@ void GeomAPI_Shape::setOrientation(const GeomAPI_Shape::Orientation theOrientati } } -bool GeomAPI_Shape::isSubShape(const std::shared_ptr theShape) const +bool GeomAPI_Shape::isSubShape(const std::shared_ptr theShape, + const bool theCheckOrientation) const { if(!theShape.get()) { return false; @@ -420,7 +421,8 @@ bool GeomAPI_Shape::isSubShape(const std::shared_ptr theShape) co } for(TopExp_Explorer anExp(*MY_SHAPE, aShapeToSearch.ShapeType()); anExp.More(); anExp.Next()) { - if(aShapeToSearch.IsEqual(anExp.Current())) { + if(theCheckOrientation ? + aShapeToSearch.IsEqual(anExp.Current()) : aShapeToSearch.IsSame(anExp.Current())) { return true; } } diff --git a/src/GeomAPI/GeomAPI_Shape.h b/src/GeomAPI/GeomAPI_Shape.h index 4e148978c..242a85bc7 100644 --- a/src/GeomAPI/GeomAPI_Shape.h +++ b/src/GeomAPI/GeomAPI_Shape.h @@ -125,7 +125,9 @@ public: /// \return true if passed shape is a sub-shape of this shape. /// \param theShape shape to search. - GEOMAPI_EXPORT virtual bool isSubShape(const std::shared_ptr theShape) const; + /// \param theCheckOrientation if false, returns true even if orientation of shape differs + GEOMAPI_EXPORT virtual bool isSubShape(const std::shared_ptr theShape, + const bool theCheckOrientation = true) const; /// Computes boundary dimensions of the shape /// Returns False if it is not possible diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 738389350..9d4fa071f 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -404,7 +404,7 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes ( } GeomShapePtr aGeomNewShape(new GeomAPI_Shape()); aGeomNewShape->setImpl(new TopoDS_Shape(aNewShape)); - if(!aRoot.IsSame(aNewShape) && aResultShape->isSubShape(aGeomNewShape)) { + if(!aRoot.IsSame(aNewShape) && aResultShape->isSubShape(aGeomNewShape, false)) { if(theIsStoreAsGenerated) { // Here we store shapes as generated, to avoid problem when one parent shape produce // several child shapes. In this case naming could not determine which shape to select. diff --git a/test.API/SHAPER/Transformations/TestTranslation_2.py b/test.API/SHAPER/Transformations/TestTranslation_2.py index 327b8e741..0f3e3e9e2 100644 --- a/test.API/SHAPER/Transformations/TestTranslation_2.py +++ b/test.API/SHAPER/Transformations/TestTranslation_2.py @@ -172,7 +172,7 @@ Translation_42 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", # Translation 43 Translation_43_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_33_1")], model.selection("EDGE", "PartSet/OX"), 5) Partition_8 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_34_1"), model.selection("SOLID", "Translation_33_1")]) -Translation_43 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_8_1")], model.selection("EDGE", "Partition_8_1_1/Modified_Face_1_4&Partition_8_1_1/Modified_Face_1_1"), 15) +Translation_43 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_8_1")], model.selection("EDGE", "Partition_8_1_1/Modified_Face_2_5&Partition_8_1_1/Modified_Face_2_2"), 15) # Translation 44 Translation_44_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_35_1")], model.selection("EDGE", "PartSet/OX"), 5)