From 7b4d56ff96f9208e96672f85a00492f5aa0f0c2f Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 1 Feb 2019 20:09:52 +0300 Subject: [PATCH] Debug of groups movement to the end for fillet feature unit-tests. --- doc/gui/conf.py.in | 4 +- src/CollectionPlugin/Test/TestGroupMove10.py | 45 ++++++++------------ src/CollectionPlugin/Test/TestGroupMove8.py | 2 +- src/Model/Model_AttributeSelection.cpp | 43 ++++++++++++++----- 4 files changed, 52 insertions(+), 42 deletions(-) diff --git a/doc/gui/conf.py.in b/doc/gui/conf.py.in index 8d222a1d7..fc9b77f6c 100644 --- a/doc/gui/conf.py.in +++ b/doc/gui/conf.py.in @@ -61,9 +61,9 @@ html_show_copyright = False # built documents. # # The short X.Y version. -version = u'3.0.0' +version = u'9.2.0' # The full version, including alpha/beta/rc tags. -release = u'3.0.0' +release = u'9.2.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/src/CollectionPlugin/Test/TestGroupMove10.py b/src/CollectionPlugin/Test/TestGroupMove10.py index 55b477439..72d235d22 100644 --- a/src/CollectionPlugin/Test/TestGroupMove10.py +++ b/src/CollectionPlugin/Test/TestGroupMove10.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from salome.shaper import model +from ModelAPI import * model.begin() partSet = model.moduleDocument() @@ -24,41 +25,29 @@ model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_3")] Group_1 = model.addGroup(Part_1_doc, Group_1_objects) -Group_2_objects = [model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2"), model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2"), model.selection("FACE", "(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_3/From_Face"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4")] -Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2][(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2][Extrusion_1_1_3/To_Face]"), model.selection("EDGE", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2][Extrusion_1_1_3/From_Face]"), model.selection("EDGE", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2][(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2]"), model.selection("EDGE", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2][Extrusion_1_1_3/To_Face]"), model.selection("EDGE", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2][Extrusion_1_1_3/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_3/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_3/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_3/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_3/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1]")] -Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("VERTEX", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_2/To_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_1/To_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_3/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_1/To_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2][(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2][Extrusion_1_1_3/To_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2][(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2][Extrusion_1_1_1/To_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_2/From_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_1/From_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2][(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2][Extrusion_1_1_1/From_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)2][(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2][Extrusion_1_1_3/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_3/From_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2][Extrusion_1_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"), model.selection("VERTEX", "[(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_1/From_Face)(Extrusion_1_1_1/To_Face)(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2)2(Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_3)2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1_3/From_Face)(Extrusion_1_1_3/To_Face)(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3)2(Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4)2][Extrusion_1_1_3/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]")] -Group_4 = model.addGroup(Part_1_doc, Group_4_objects) +# to create groups of faces, edges and vertices +model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc) +model.do() Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Extrusion_1_1")) Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3")]) model.do() # move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), Remove_SubShapes_1.feature()) -Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) -Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) -Part_1_doc.moveFeature(Group_4.feature(), Group_3.feature()) +LastFeature = Remove_SubShapes_1.feature() +for i in range(Part_1_doc.size("Groups")): + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", 0))) # move always the very first group + Part_1_doc.moveFeature(GroupFeature, LastFeature) + LastFeature = GroupFeature model.end() -from ModelAPI import * - aFactory = ModelAPI_Session.get().validators() -# groups should exclude removed sub-shapes -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) - -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_2.feature())) - -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 30) -assert(aFactory.validate(Group_3.feature())) - -selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 20) -assert(aFactory.validate(Group_4.feature())) +# Check groups +a = 0 +num_in_groups = [1, 10, 15, 7] +for i in range(Part_1_doc.size("Groups")): + GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i))) + assert(aFactory.validate(GroupFeature)) + assert(GroupFeature.selectionList("group_list").size() == num_in_groups[a]) + a = a + 1 assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove8.py b/src/CollectionPlugin/Test/TestGroupMove8.py index 7c0451e57..91fbcc384 100644 --- a/src/CollectionPlugin/Test/TestGroupMove8.py +++ b/src/CollectionPlugin/Test/TestGroupMove8.py @@ -84,7 +84,7 @@ assert(selectionList.size() == 3) assert(aFactory.validate(Group_5.feature())) selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 3) +assert(selectionList.size() == 2) # edge selected for the fillet become removed assert(aFactory.validate(Group_6.feature())) model.begin() diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 813544312..91bfa0608 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -1086,9 +1086,10 @@ void Model_AttributeSelection::computeValues( if (aWasWholeContext) { theValShape = theOldContext->shape()->impl(); } + TopAbs_ShapeEnum aValType = theValShape.ShapeType(); TopoDS_Shape aNewContShape = theNewContext->shape()->impl(); // if a new value is unchanged in the new context, do nothing: value is correct - TopExp_Explorer aSubExp(aNewContShape, theValShape.ShapeType()); + TopExp_Explorer aSubExp(aNewContShape, aValType); for(; aSubExp.More(); aSubExp.Next()) { if (aSubExp.Current().IsSame(theValShape)) { theShapes.Append(theValShape); @@ -1133,17 +1134,15 @@ void Model_AttributeSelection::computeValues( return; } // don't add edges generated from faces - if (aPairIter.NewShape().ShapeType() <= theValShape.ShapeType()) + if (aPairIter.NewShape().ShapeType() <= aValType) theShapes.Append(aPairIter.NewShape()); } } else if (!aPairIter.OldShape().IsNull()) { // search shape that contains this sub - TopExp_Explorer anExp(aPairIter.OldShape(), theValShape.ShapeType()); + TopExp_Explorer anExp(aPairIter.OldShape(), aValType); for(; anExp.More(); anExp.Next()) { if (anExp.Current().IsSame(theValShape)) { // found a new container - if (aPairIter.NewShape().IsNull()) {// value was removed - theShapes.Clear(); - return; - } + if (aPairIter.NewShape().IsNull()) // skip removed high-level shape + continue; aNewToOld.Bind(aPairIter.NewShape(), aPairIter.OldShape()); anOlds.Add(aPairIter.OldShape()); break; @@ -1160,7 +1159,7 @@ void Model_AttributeSelection::computeValues( NCollection_Map aNewTypes; // types of shapes to iterate TopTools_DataMapOfShapeShape::Iterator aNewTypeIter(aNewToOld); for(; aNewTypeIter.More(); aNewTypeIter.Next()) { - if (aNewTypeIter.Key().ShapeType() != theValShape.ShapeType()) + if (aNewTypeIter.Key().ShapeType() != aValType) aNewTypes.Add(aNewTypeIter.Key().ShapeType()); } NCollection_Map::Iterator aTypeIter(aNewTypes); @@ -1169,7 +1168,7 @@ void Model_AttributeSelection::computeValues( TopoDS_Shape anOld = anExp.Current(); if (aNewToOld.IsBound(anOld) || anOlds.Contains(anOld)) // this was modified continue; - TopExp_Explorer aValExp(anOld, theValShape.ShapeType()); + TopExp_Explorer aValExp(anOld, aValType); for(; aValExp.More(); aValExp.Next()) { const TopoDS_Shape& anUnchanged = aValExp.Current(); if (anUnchanged.IsSame(theValShape)) { @@ -1185,7 +1184,7 @@ void Model_AttributeSelection::computeValues( NCollection_DataMap aSubs; TopTools_DataMapOfShapeShape::Iterator aContIter(aNewToOld); for(; aContIter.More(); aContIter.Next()) { - TopExp_Explorer aSubExp(aContIter.Key(), theValShape.ShapeType()); + TopExp_Explorer aSubExp(aContIter.Key(), aValType); for(; aSubExp.More(); aSubExp.Next()) { if (!aSubs.IsBound(aSubExp.Current())) { aSubs.Bind(aSubExp.Current(), TopTools_MapOfShape()); @@ -1216,13 +1215,35 @@ void Model_AttributeSelection::computeValues( if (aWasWholeContext) theShapes.Append(TopoDS_Shape()); else { // if theValShape exists in new context, add it without changes, otherwise - nothing - for (TopExp_Explorer aNew(aNewContShape, theValShape.ShapeType()); aNew.More(); aNew.Next()){ + for (TopExp_Explorer aNew(aNewContShape, aValType); aNew.More(); aNew.Next()){ if (aNew.Current().IsSame(theValShape)) { theShapes.Append(theValShape); break; } } } + } else if (theShapes.Size() > 1) { + // check it is possible to remove extra sub-shapes: + // keep only shapes with the same number of containers if possible + TopAbs_ShapeEnum anAncType = TopAbs_FACE; + if (aValType == TopAbs_VERTEX) + anAncType = TopAbs_EDGE; + TopoDS_Shape anOldContext = theOldContext->shape()->impl(); + TopTools_IndexedDataMapOfShapeListOfShape anOldMap; + TopExp::MapShapesAndUniqueAncestors(anOldContext, aValType, anAncType, anOldMap); + if (anOldMap.Contains(theValShape)) { + int aNumInOld = anOldMap.FindFromKey(theValShape).Extent(); + TopTools_IndexedDataMapOfShapeListOfShape aNewMap; + TopExp::MapShapesAndUniqueAncestors(aNewContShape, aValType, anAncType, aNewMap); + TopTools_ListOfShape aNewResults; + for(TopTools_ListOfShape::Iterator aNewSubs(theShapes); aNewSubs.More(); aNewSubs.Next()) { + TopoDS_Shape aCand = aNewSubs.Value(); + if (aNewMap.Contains(aCand) && aNewMap.FindFromKey(aCand).Extent() == aNumInOld) + aNewResults.Append(aCand); + } + if (!aNewResults.IsEmpty() && aNewResults.Size() < theShapes.Size()) + theShapes = aNewResults; + } } } -- 2.39.2