]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix of unit-tests. Advanced logic for the latest context searching in the filter...
authormpv <mpv@opencascade.com>
Mon, 29 Oct 2018 08:28:24 +0000 (11:28 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
15 files changed:
src/FeaturesPlugin/Test/Test2394.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace1.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace3.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace4.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithFace5.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane1.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane3.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane5.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid1.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid2.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid4.py
src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithSolid5.py
src/Model/Model_AttributeSelection.cpp
src/Model/Model_Objects.cpp

index c602257145bf3eea2945d4a94584fac4e621a3ad..47e885512a10af1ec0fd5b1601e61055627111a7 100644 (file)
@@ -20,6 +20,7 @@
 
 # -*- coding: utf-8 -*-
 
+from GeomAPI import *
 from SketchAPI import *
 
 from salome.shaper import model
@@ -39,7 +40,6 @@ model.addParameter(Part_1_doc, "z", "R*cos(phi/180*pi)")
 model.addParameter(Part_1_doc, "haut_ext_tuyau", "5")
 model.addParameter(Part_1_doc, "haut_int_tuyau", "14")
 Param_Diam = model.addParameter(Part_1_doc, "diam_tuyau", "10")
-
 Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 90, 0)
 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
@@ -83,13 +83,13 @@ SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(
 Extrusion_1.setNestedSketch(Sketch_2)
 Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
 Point_2 = model.addPoint(Part_1_doc, "x", "y", "-z")
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "[Fill_1_1_2/Modified_Face&Sketch_2/SketchLine_4&Revolution_1_1/From_Face][Fill_1_1_2/Modified_Face&Extrusion_1_1/To_Face&Sketch_1/SketchLine_3][Fill_1_1_2/Modified_Face&Sketch_2/SketchLine_5&Revolution_1_1/To_Face]"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "[Fill_1_1_2/Modified_Face&Sketch_2/SketchLine_5&Revolution_1_1/To_Face][Fill_1_1_2/Modified_Face&Sketch_2/SketchLine_4&Revolution_1_1/From_Face][Fill_1_1_2/Modified_Face&Extrusion_1_1/To_Face&Sketch_1/SketchLine_3]"))
 Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Point_1"), True)
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "haut_ext_tuyau", True)
 Plane_5.result().setName("Plane_2 arrivee tuyau")
-Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6"), model.selection("EDGE", "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6]"), 45)
+Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"), 45)
 Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/From_Face]"), 45)
-Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6]"), "90+45")
+Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7]"), "90+45")
 Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_1")], [model.selection("FACE", "Plane_5")])
 Fill_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_2_1_2")], [model.selection("FACE", "Plane_3")])
 Fill_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_3_1_2")], [model.selection("FACE", "Plane_4")])
@@ -141,10 +141,10 @@ model.do()
 Extrusion_2_objects = [model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_14r-SketchLine_11f-SketchLine_16r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchLine_17r-SketchLine_10f-SketchLine_14f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_15r-SketchLine_13f-SketchLine_17f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_16f-SketchLine_12f-SketchLine_15f")]
 Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), 10, 0)
 Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r")], model.selection(), "haut_int_tuyau", 0)
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_3"))
-SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1/To_Face_3][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15]"), False)
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1_3/To_Face"))
+SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/To_Face]"), False)
 SketchPoint_3 = SketchProjection_6.createdFeature()
-SketchProjection_7 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1/To_Face_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_2]"), False)
+SketchProjection_7 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/To_Face]"), False)
 SketchPoint_4 = SketchProjection_7.createdFeature()
 SketchArc_2 = Sketch_4.addArc(0, 0, -7.071067811865476, -7.071067811865472, 7.071067811865476, 7.071067811865472, True)
 SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchPoint_3.result(), SketchArc_2.startPoint())
@@ -152,22 +152,22 @@ SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchPoint_4.result(),
 SketchLine_18 = Sketch_4.addLine(7.071067811865476, 7.071067811865472, -7.071067811865476, -7.071067811865472)
 SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchLine_18.startPoint())
 SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_18.endPoint())
-SketchProjection_8 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_5][Extrusion_2_1/To_Face_1][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_14]"), False)
+SketchProjection_8 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/To_Face]"), False)
 SketchPoint_5 = SketchProjection_8.createdFeature()
 SketchConstraintCoincidence_30 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchAPI_Point(SketchPoint_5).coordinates())
 model.do()
 Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/SketchLine_18"), 0, 180)
 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
 Cut_1.result().setName("demi-sphere")
-Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1/From_Face_1][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_16]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1/To_Face_1]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_5][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1/To_Face_1]"))
-Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1/To_Face_1][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_14]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_5][Extrusion_2_1/To_Face_1][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_14]"), model.selection("VERTEX", "[Extrusion_2_1/From_Face_1][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_5][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_14]"))
-Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1/To_Face_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_2]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_10][Extrusion_2_1/To_Face_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_17]"), model.selection("VERTEX", "[Extrusion_2_1/From_Face_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_2]"))
-Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1/To_Face_3][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_13]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1/To_Face_3][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1/From_Face_3]"))
+Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/To_Face]"))
+Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/From_Face]"))
+Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_10][Extrusion_2_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/From_Face]"))
+Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_13][Extrusion_2_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/From_Face]"))
 Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_3.result()])
 Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape_4"), model.selection("EDGE", "[Recover_1_1/Shape_4][Recover_1_1/Shape_6]"), "90+45")
-Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape_1"), model.selection("EDGE", "[Recover_1_1/Shape_6][Recover_1_1/Shape_1]"), "90+45")
-Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape_2"), model.selection("EDGE", "[Recover_1_1/Shape_6][Recover_1_1/Shape_2]"), "90+45")
-Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape_6"), model.selection("EDGE", "[Recover_1_1/Shape_6][Recover_1_1/Shape_3]"), 45)
+Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape_1"), model.selection("EDGE", "[Recover_1_1/Shape_1][Recover_1_1/Shape_6]"), "90+45")
+Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape_2"), model.selection("EDGE", "[Recover_1_1/Shape_2][Recover_1_1/Shape_6]"), "90+45")
+Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape_6"), model.selection("EDGE", "[Recover_1_1/Shape_3][Recover_1_1/Shape_6]"), 45)
 Fill_5_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
 Fill_5 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Fill_5_objects_2)
 Fill_5.result().subResult(0).setName("Fill_5_1_1")
index fc00daa1cb6b6b48696d9d5bcb2daf0b950f1f2c..9ba9d1360e56cebb179a2311211e791b3a39e24b 100644 (file)
@@ -44,7 +44,7 @@ SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(),
 model.do()
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
 Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "Face_1_1")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1")])
 model.do()
 
 # check partition
index 767544192e51be01f41075840ecee1fcb21036a9..1a3a6c59ce534e91f73bfd33aa6a8e23ef5cb564 100644 (file)
@@ -44,7 +44,7 @@ SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(),
 model.do()
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
 Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")])
 model.do()
 
 # check partition
index c9587cbe9783ffa5919f64dd4fb34460bd304859..a11e6bba595ce7d3f79f2eb1af1cdb4908abde92 100644 (file)
@@ -44,7 +44,7 @@ SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(),
 model.do()
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
 Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
-Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "Face_1_1")]
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
index 410c586497162979ca684a767968cf51c74c33a7..8bacb70a9382c16227ede4158b92bf0dc166165a 100644 (file)
@@ -44,7 +44,7 @@ SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(),
 model.do()
 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
 Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
-Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_1_1_3")]
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_1_1_3")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
index a2c3723c0158cb6cb1b387e5b0fc53e7de7ed205..68efb93250c71c65a1ec6ffcc433fecf4d8e0969 100644 (file)
@@ -36,7 +36,7 @@ SketchCircle_2 = Sketch_1.addCircle(55, 30, 40)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "PartSet/XOZ")])
 model.do()
 
 # check partition
index 8cd4be4f7a6b603ccfd3974fc58dc6d923e2b514..0d8668bd13b1945ae804aa1d75bc2ee54b64bb2a 100644 (file)
@@ -36,7 +36,7 @@ SketchCircle_2 = Sketch_1.addCircle(55, 30, 40)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "PartSet/XOZ")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")])
 model.do()
 
 # check partition
index 38551ef73c739bd2a77d47653f65542babe2c1aa..c44f1b6dd501fb4ddb0188bbc1e64ea0794a12ea 100644 (file)
@@ -36,7 +36,7 @@ SketchCircle_2 = Sketch_1.addCircle(55, 30, 40)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "PartSet/XOZ")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")])
 model.do()
 
 # check partition
index 76d096236e24659b4b8c65370a93f87542af9284..e2f6f34d2cc406a508bbfad9bf7441db2c69ee07 100644 (file)
@@ -36,7 +36,7 @@ SketchCircle_2 = Sketch_1.addCircle(55, 30, 40)
 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
-Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")]
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
index 5eb28b156d404297479c9b5116ce1ae27c285fdf..c7adbf2c94b31dc726e438e088a8a5af69705cf3 100644 (file)
@@ -38,7 +38,7 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radi
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
 Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Box_1_1")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")])
 model.do()
 
 # check partition
index 75e447ae9f791481d7b6516643dc16000998197f..5097340fef61f6116b16b3fa23bcc83c65310406 100644 (file)
@@ -38,7 +38,7 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radi
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
 Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Box_1_1")]
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
index 340689eefc71217da082c7fc2925f6b84d508744..718d720372226b064bd3744fb7280aead1a14ac2 100644 (file)
@@ -38,7 +38,7 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radi
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
 Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_3")]
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
index 30333235d795ae0ab47de8c997847f35bf29796a..61627dbed985f757003c32264362f00e2bdfdae3 100644 (file)
@@ -38,7 +38,7 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radi
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
 Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3")]
+Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
 model.do()
 
index 7dc0453dd764cd71d068785a839f9c764a1278d0..c33a3019576966a8e239c97d237decfa9ec03194 100644 (file)
@@ -49,6 +49,7 @@
 #include <TNaming_Tool.hxx>
 #include <TNaming_Builder.hxx>
 #include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_NewShapeIterator.hxx>
 #include <TNaming_Iterator.hxx>
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_UAttribute.hxx>
@@ -1741,6 +1742,48 @@ ResultPtr Model_AttributeSelection::newestContext(
         }
       }
     }
+    if (theAnyValue) { // only for neighbours for now
+      // try to find modification of sub-shapes: the best number of matches
+      std::map<ResultPtr, int> aMatches; // result -> number of matches of shapes to find the best
+      TDF_Label aResLab = std::dynamic_pointer_cast<Model_Data>(aResult->data())->shapeLab();
+      TDF_ChildIDIterator aModifIter(aResLab, TNaming_NamedShape::GetID());
+      for(; aModifIter.More(); aModifIter.Next()) {
+        Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aModifIter.Value());
+        if (aNS->Evolution() == TNaming_MODIFY || aNS->Evolution() == TNaming_GENERATED) {
+          for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+            TNaming_NewShapeIterator aNewIter(aNSIter.NewShape(), aNS->Label());
+            for(; aNewIter.More(); aNewIter.Next()) {
+              TDF_Label aLab = aNewIter.Label();
+              if (isLater(aLab, aNS->Label()) && isLater(selectionLabel(), aLab)) {
+                ResultPtr aRes = aDoc->resultByLab(aLab);
+                if (aRes.get()) {
+                  if (aMatches.find(aRes) == aMatches.end())
+                    aMatches[aRes] = 0;
+                  aMatches[aRes]++; // found result, add matches
+                }
+              }
+            }
+          }
+        }
+      }
+      // searching for the best result-candidate
+      int aBest = 0;
+      ResultPtr aBestResult;
+      std::map<ResultPtr, int>::iterator aMatchIter = aMatches.begin();
+      for(; aMatchIter != aMatches.end(); aMatchIter++) {
+        if (aMatchIter->second > aBest) {
+          aBest = aMatchIter->second;
+          aBestResult = aMatchIter->first;
+        }
+      }
+      if (aBestResult.get()) {
+        aResult = aBestResult;
+        aFindNewContext = true;
+        continue;
+      }
+    }
+
+
     // TestFillWireVertex.py - sketch constructions for wire may participate too
     //if (aResult->groupName() == ModelAPI_ResultBody::group()) {
       // try to search newer context by the concealment references
index 2a66adc60e466d8b716d493ae39dda1b1f8d9809..18dfb85732a31f8984e4a6bbb4404ddcf0a89818 100644 (file)
@@ -627,15 +627,17 @@ std::shared_ptr<ModelAPI_Object> Model_Objects::objectByName(
   createHistory(theGroupID);
   if (theGroupID == ModelAPI_Feature::group()) { // searching among features (in history or not)
     std::list<std::shared_ptr<ModelAPI_Feature> > allObjs = allFeatures();
-    std::list<std::shared_ptr<ModelAPI_Feature> >::iterator anObjIter = allObjs.begin();
-    for(; anObjIter != allObjs.end(); anObjIter++) {
+    // from the end to find the latest result with such name
+    std::list<std::shared_ptr<ModelAPI_Feature> >::reverse_iterator anObjIter = allObjs.rbegin();
+    for(; anObjIter != allObjs.rend(); anObjIter++) {
       if ((*anObjIter)->data()->name() == theName)
         return *anObjIter;
     }
   } else { // searching among results (concealed or not)
     std::list<std::shared_ptr<ModelAPI_Feature> > allObjs = allFeatures();
-    std::list<std::shared_ptr<ModelAPI_Feature> >::iterator anObjIter = allObjs.begin();
-    for(; anObjIter != allObjs.end(); anObjIter++) {
+    // from the end to find the latest result with such name
+    std::list<std::shared_ptr<ModelAPI_Feature> >::reverse_iterator anObjIter = allObjs.rbegin();
+    for(; anObjIter != allObjs.rend(); anObjIter++) {
       std::list<ResultPtr> allRes;
       ModelAPI_Tools::allResults(*anObjIter, allRes);
       for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) {