1 # Created a Part Remove/Duplicate API functionality since from low level and python dump it is not
2 # tested: feature history infor is not stored.
6 # prepare axis created by PartSet and Part points
8 PartSet = model.moduleDocument()
9 Part_1 = model.addPart(PartSet)
10 Part_1_doc = Part_1.document()
11 Point_2 = model.addPoint(Part_1_doc, 100, 50, 20)
12 Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Point_1"))
15 # Duplicate this part twice, duplicate the first Copy also
16 Copy_1 = model.duplicatePart(Part_1)
17 Copy_2 = model.duplicatePart(Part_1)
18 Copy_3 = model.duplicatePart(Copy_1)
21 # check the intermediate result
22 assert PartSet.size("Parts") == 4
24 for n in ["Part_1", "Part_3", "Part_2", "Part_4"]:
25 assert PartSet.object("Parts", i).data().name() == n
28 # Remove the middle Part
29 model.removePart(Copy_2)
32 # check the intermediate result
33 assert PartSet.size("Parts") == 3
35 for n in ["Part_1", "Part_2", "Part_4"]:
36 assert PartSet.object("Parts", i).data().name() == n
40 model.removePart(Copy_1)
43 # Undo the last remove
47 assert PartSet.size("Parts") == 3
49 for n in ["Part_1", "Part_2", "Part_4"]:
50 assert PartSet.object("Parts", i).data().name() == n