# -*- coding: utf-8 -*-
from salome.shaper import model
+from ModelAPI import *
model.begin()
partSet = model.moduleDocument()
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())
if (aWasWholeContext) {
theValShape = theOldContext->shape()->impl<TopoDS_Shape>();
}
+ TopAbs_ShapeEnum aValType = theValShape.ShapeType();
TopoDS_Shape aNewContShape = theNewContext->shape()->impl<TopoDS_Shape>();
// 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);
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;
NCollection_Map<TopAbs_ShapeEnum> 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<TopAbs_ShapeEnum>::Iterator aTypeIter(aNewTypes);
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)) {
NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> 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());
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<TopoDS_Shape>();
+ 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;
+ }
}
}