From: mpv Date: Wed, 24 May 2017 06:06:16 +0000 (+0300) Subject: Created a unit-test for the issue #2170 X-Git-Tag: V_2.7.1.1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a1a6f4905d929b9a1ee9e71c862974d877bb73d;p=modules%2Fshaper.git Created a unit-test for the issue #2170 --- diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index fea8bb975..51a720fe4 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -147,5 +147,6 @@ ADD_UNIT_TESTS(TestConstants.py Test1757.py Test1998.py Test1995.py + Test2170.py TestExternalConstruction.py ) diff --git a/src/ModelAPI/Test/Test2170.py b/src/ModelAPI/Test/Test2170.py new file mode 100644 index 000000000..a078af863 --- /dev/null +++ b/src/ModelAPI/Test/Test2170.py @@ -0,0 +1,60 @@ +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +model.addParameter(Part_1_doc, "g", "5") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(0, 200, 0, 0) +SketchLine_2 = Sketch_1.addLine(0, 0, 250, 0) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(500, 0, 500, 200) +SketchArc_1 = Sketch_1.addArc(250, 200.000000000003, 0, 200, 500, 200, True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint()) +SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3") +SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1]) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchArc_1.endPoint()) +SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4") +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5") +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 250) +SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchPoint_1.coordinates()) +SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6") +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 200) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 200) +SketchArc_2 = Sketch_1.addArc(250, 0, 1.232595164407831e-032, 0, 500, 0, False) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_2.center()) +SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7") +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8") +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint()) +SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10") +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.results()[1], SketchArc_2.startPoint()) +SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11") +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12") +model.do() +Sketch_1.setName("toto") +Sketch_1.result().setName("tutu") +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "tutu/Face-SketchLine_1f-SketchLine_3f-SketchArc_1_2f-SketchArc_2_2f")], model.selection(), 10, 0) +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "tutu/Edge-SketchLine_2")]) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 100, 0) +Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Extrusion_2_1/Generated_Edge_2&Extrusion_2_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Edge_1&Extrusion_2_1/To_Edge_1")]) +model.end() + +# check that resulting group selection is valid +from ModelAPI import * +aFactory = ModelAPI_Session.get().validators() +assert(aFactory.validate(Group_1.feature())) +assert(Group_1.groupList().size() == 2) +assert(Group_1.groupList().value(0).value().shapeTypeStr() == "VERTEX") +assert(Group_1.groupList().value(1).value().shapeTypeStr() == "VERTEX") + +assert(model.checkPythonDump())