]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/Test/Test1995.py
Salome HOME
9a64c6502f0d5c53026e591dec2cd6bf164c7d5b
[modules/shaper.git] / src / ModelAPI / Test / Test1995.py
1 # Lighter case to reproduce problem of #1995
2 # The problem was in axis that contained sub-shapes naming of the sketch and the extrusion becomes
3 # use this axis. So, on remove of the axis, the naming is failed. Same for modifications of the sketch 1.
4
5 from salome.shaper import model
6
7 model.begin()
8 partSet = model.moduleDocument()
9 Part_1 = model.addPart(partSet)
10 Part_1_doc = Part_1.document()
11 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
12 SketchLine_1 = Sketch_1.addLine(175.5289977047663, 37.215818549061, -134.623385345167, 37.215818549061)
13 SketchLine_2 = Sketch_1.addLine(-134.623385345167, 37.215818549061, -134.623385345167, -108.7867760111381)
14 SketchLine_3 = Sketch_1.addLine(-134.623385345167, -108.7867760111381, 175.5289977047663, -108.7867760111381)
15 SketchLine_4 = Sketch_1.addLine(175.5289977047663, -108.7867760111381, 175.5289977047663, 37.215818549061)
16 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
17 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
18 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
19 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
20 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
21 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
22 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
23 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
24 model.do()
25 Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"))
26 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
27 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
28 SketchCircle_1 = Sketch_2.addCircle(12.88847795756506, 28.93359954982685, 11.55225986344597)
29 model.do()
30
31 # now remove axis to destroy naming structure if extrusion refers to it
32 Part_1_doc.removeFeature(Axis_4.feature())
33 # also update sketch_1 to launch recomputation of everything
34 SketchLine_1.setStartPoint(170, -130)
35 model.end()
36
37 import ModelAPI
38 assert(ModelAPI.ModelAPI_Session.get().validators().validate(Sketch_2.feature()))