]> SALOME platform Git repositories - modules/shaper.git/blob - src/CollectionPlugin/Test/TestGroup1799.py
Salome HOME
A unit test for the issue #1799
[modules/shaper.git] / src / CollectionPlugin / Test / TestGroup1799.py
1 # This test is based on the issue 1799: after faces are splitted and group is moved
2 # down, the group-faces also must be splitted, the AttributeSelectionList should contain
3 # 4 times more faces.
4 # The biggest part of the code is python dump of the updated_for_1799.hdf file from this issue.
5
6 import model
7 from ModelAPI import *
8
9 model.begin()
10 partSet = model.moduleDocument()
11 Part_1 = model.addPart(partSet)
12 Part_1_doc = Part_1.document()
13 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
14 SketchLine_1 = Sketch_1.addLine(350, 250, 1.524660639134633e-014, 250)
15 SketchLine_2 = Sketch_1.addLine(-350, 1.720151798778602e-014, -350, -250)
16 SketchLine_3 = Sketch_1.addLine(-350, -250, 1.524660628546721e-014, -250)
17 SketchLine_4 = Sketch_1.addLine(350, -250, 350, 1.720151798778602e-014)
18 SketchLine_5 = Sketch_1.addLine(350, 1.720151798778602e-014, 350, 250)
19 SketchLine_5.setName("SketchLine_7")
20 SketchLine_5.result().setName("SketchLine_7")
21 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint())
22 SketchLine_6 = Sketch_1.addLine(1.524660639134633e-014, 250, -350, 250)
23 SketchLine_6.setName("SketchLine_5")
24 SketchLine_6.result().setName("SketchLine_5")
25 SketchLine_7 = Sketch_1.addLine(-350, 250, -350, 1.720151798778602e-014)
26 SketchLine_7.setName("SketchLine_6")
27 SketchLine_7.result().setName("SketchLine_6")
28 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
29 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
30 SketchLine_8 = Sketch_1.addLine(1.524660628546721e-014, -250, 350, -250)
31 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_4.startPoint())
32 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
33 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
34 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
35 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
36 SketchCircle_1 = Sketch_1.addCircle(0, 0, 101.5814068355669)
37 SketchPoint_1 = Sketch_1.addPoint(1.524660639134633e-014, 250)
38 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.endPoint())
39 SketchPoint_2 = Sketch_1.addPoint(-350, 1.720151798778602e-014)
40 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_2.startPoint())
41 SketchPoint_3 = Sketch_1.addPoint(1.524660628546721e-014, -250)
42 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_3.endPoint())
43 SketchPoint_4 = Sketch_1.addPoint(101.5814068355669, 1.720151798778602e-014)
44 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchCircle_1.results()[1])
45 SketchPoint_5 = Sketch_1.addPoint(-101.5814068355669, 1.720151798778602e-014)
46 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchCircle_1.results()[1])
47 SketchPoint_6 = Sketch_1.addPoint(1.524660639134633e-014, 101.5814068355669)
48 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchCircle_1.results()[1])
49 SketchPoint_7 = Sketch_1.addPoint(1.524660628546721e-014, -101.5814068355669)
50 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchCircle_1.results()[1])
51 SketchPoint_8 = Sketch_1.addPoint(350, 1.720151798778602e-014)
52 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_4.endPoint())
53 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.startPoint())
54 SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_1.result(), SketchLine_6.result())
55 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_2.startPoint())
56 SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_7.result())
57 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
58 SketchConstraintParallel_3 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_5.result())
59 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_8.startPoint())
60 SketchConstraintParallel_4 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_8.result())
61 SketchLine_9 = Sketch_1.addLine(1.524660639134633e-014, 250, 1.524660639134633e-014, 101.5814068355669)
62 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_9.startPoint())
63 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.startPoint())
64 SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_9.startPoint())
65 SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_9.endPoint())
66 SketchLine_10 = Sketch_1.addLine(-101.5814068355669, 1.720151798778602e-014, -350, 1.720151798778602e-014)
67 SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_10.startPoint())
68 SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_10.endPoint())
69 SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_10.endPoint())
70 SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint())
71 SketchLine_11 = Sketch_1.addLine(1.524660628546721e-014, -250, 1.524660628546721e-014, -101.5814068355669)
72 SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_11.startPoint())
73 SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_11.startPoint())
74 SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_11.startPoint())
75 SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_11.endPoint())
76 SketchLine_12 = Sketch_1.addLine(350, 1.720151798778602e-014, 101.5814068355669, 1.720151798778602e-014)
77 SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_12.startPoint())
78 SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_12.startPoint())
79 SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_12.startPoint())
80 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_9.result())
81 SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_11.result())
82 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_10.result())
83 SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_12.result())
84 SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_9.result(), SketchLine_11.endPoint())
85 SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_10.result(), SketchLine_12.startPoint())
86 SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_12.endPoint())
87 SketchPoint_9 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
88 SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchPoint_9.coordinates())
89 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_6.result())
90 SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_8.result())
91 SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_10.result(), SketchLine_12.result())
92 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_6.result(), 350)
93 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_7.result(), 250)
94 SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result())
95 SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_2.result())
96 model.do()
97 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_5f-SketchLine_6f-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchCircle_1_2r-SketchLine_7f-SketchLine_9f-SketchLine_12r"), model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchCircle_1_2r-SketchLine_8f-SketchLine_11r-SketchLine_12f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchCircle_1_2r-SketchLine_10f-SketchLine_11f")], model.selection(), 150, 0)
98 Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/To_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_3"), model.selection("FACE", "Extrusion_1_1/To_Face_2")])
99 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), 150, True)
100 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_7"), 150, True)
101 Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_2")])
102 Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1/Modified_Face_1_2_1"), 110, True)
103 Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1/Modified_Face_1_9_1"), 380, True)
104 Partition_2 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_3"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("FACE", "Plane_4")])
105 model.do()
106
107 # check that group contains only 4 faces
108 selectionList = Group_1.feature().selectionList("group_list")
109 assert(selectionList.size() == 4)
110 aFactory = ModelAPI_Session.get().validators()
111 assert(aFactory.validate(Group_1.feature()))
112 # move group to the end: it must be recomputed, faces are splitted
113 Part_1_doc.moveFeature(Group_1.feature(), Partition_2.feature())
114 model.end()
115
116 # check that number of faces becomes 4*4=16 and Group is valid
117 assert(selectionList.size() == 16)
118 assert(aFactory.validate(Group_1.feature()))