]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the correct selection shared faces of results of Partition (in case the share...
authormpv <mpv@opencascade.com>
Wed, 1 Nov 2017 11:30:22 +0000 (14:30 +0300)
committermpv <mpv@opencascade.com>
Wed, 1 Nov 2017 11:30:43 +0000 (14:30 +0300)
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.

src/CollectionPlugin/Test/TestGroup1799.py
src/FeaturesPlugin/Test/Test2240.py
src/GeomAPI/GeomAPI_Shape.cpp
src/GeomAPI/GeomAPI_Shape.h
src/Model/Model_BodyBuilder.cpp
test.API/SHAPER/Transformations/TestTranslation_2.py

index 8a767c0e71af344d0b444ca9e8bb0825b40dea20..d048d7b4a0cc199b579191035a9fe4890d9dac21 100644 (file)
@@ -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()
 
index 5317ea29b425ba88ba9c1d704b8619285afc9b17..2c1821acc9ba8d68f48bbcb70ecdb6648fe81a6f 100644 (file)
@@ -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)
index c1df335558bd9f4f7680e158f68a43984bd27619..f66a6a1e6f8e9351cfa20cd7e1d0ed40292f488e 100644 (file)
@@ -408,7 +408,8 @@ void GeomAPI_Shape::setOrientation(const GeomAPI_Shape::Orientation theOrientati
   }
 }
 
-bool GeomAPI_Shape::isSubShape(const std::shared_ptr<GeomAPI_Shape> theShape) const
+bool GeomAPI_Shape::isSubShape(const std::shared_ptr<GeomAPI_Shape> theShape,
+                               const bool theCheckOrientation) const
 {
   if(!theShape.get()) {
     return false;
@@ -420,7 +421,8 @@ bool GeomAPI_Shape::isSubShape(const std::shared_ptr<GeomAPI_Shape> 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;
     }
   }
index 4e148978cd162140c5b9316ebd6ef0e5d89c9c6a..242a85bc7fcabca5368a687a771ae9bd57e27294 100644 (file)
@@ -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<GeomAPI_Shape> theShape) const;
+  /// \param theCheckOrientation if false, returns true even if orientation of shape differs
+  GEOMAPI_EXPORT virtual bool isSubShape(const std::shared_ptr<GeomAPI_Shape> theShape,
+    const bool theCheckOrientation = true) const;
 
   /// Computes boundary dimensions of the shape
   /// Returns False if it is not possible
index 7383893501168275c139f7ca92e9f57e9500ac7e..9d4fa071f8d0ac58404226a72df520b2e64ae11c 100755 (executable)
@@ -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.
index 327b8e741ccd25be359cff69b3b91477c2c4889d..0f3e3e9e2158dccd1bf4e610aabb06661d4f6d90 100644 (file)
@@ -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)