From 7f5624c525a82fb39fd2fca32fa5e872b2aa319a Mon Sep 17 00:00:00 2001 From: dbv Date: Thu, 25 Oct 2018 16:41:40 +0300 Subject: [PATCH] Tests fix --- src/FeaturesPlugin/Test/TestRecover1798.py | 106 ++++++++++-------- .../Test/TestRemoveSubShapes2.py | 4 +- 2 files changed, 60 insertions(+), 50 deletions(-) diff --git a/src/FeaturesPlugin/Test/TestRecover1798.py b/src/FeaturesPlugin/Test/TestRecover1798.py index 1adcbd13e..40085922c 100644 --- a/src/FeaturesPlugin/Test/TestRecover1798.py +++ b/src/FeaturesPlugin/Test/TestRecover1798.py @@ -18,6 +18,8 @@ ## email : webmaster.salome@opencascade.com ## +# -*- coding: utf-8 -*- + from salome.shaper import model model.begin() @@ -54,7 +56,7 @@ SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_11 = Sketch_1.addLine(-70, 0, -90, 0) SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_9.result()) -SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_10.result(), 70) +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_10.result(), 70, False) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_10.result()) SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_4.result()) @@ -66,10 +68,10 @@ SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_5") -SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), 80) -SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_1.result(), 90) -SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.result(), 85) -SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_1.result(), 90) +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), 80, False) +SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_1.result(), 90, False) +SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.result(), 85, False) +SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_1.result(), 90, False) SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_2.startPoint()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_10.result(), 190) SketchConstraintLength_1.setName("SketchConstraintLength_3") @@ -92,40 +94,44 @@ SketchConstraintHorizontal_5.setName("SketchConstraintHorizontal_8") SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_13.result(), SketchLine_4.endPoint()) SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_17") model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchLine_11r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 180, 0) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Revolution_1_1/From_Face_1"), 120, True) +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")], model.selection("EDGE", "Sketch_1/SketchLine_1"), 180, 0) +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Revolution_1_1/From_Face"), 120, True) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")) +SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False) SketchLine_14 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX")) +SketchLine_14.setName("SketchLine_14") +SketchLine_14.result().setName("SketchLine_14") +SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) SketchLine_15 = SketchProjection_2.createdFeature() -SketchLine_16 = Sketch_2.addLine(-15.00002401644285, 44.20204102886705, 14.99999932366307, 44.20204102886705) +SketchLine_15.setName("SketchLine_15") +SketchLine_15.result().setName("SketchLine_15") +SketchLine_16 = Sketch_2.addLine(-15, 44.202041028867, 15, 44.20204102886701) SketchLine_16.setName("SketchLine_24") SketchLine_16.result().setName("SketchLine_24") -SketchLine_17 = Sketch_2.addLine(-25, 88.20203643108667, -25, 54.20202402898175) +SketchLine_17 = Sketch_2.addLine(-25, 88.20204102886699, -25, 54.202041028867) SketchLine_17.setName("SketchLine_28") SketchLine_17.result().setName("SketchLine_28") -SketchLine_18 = Sketch_2.addLine(25, 54.2020551101737, 25, 88.20204066628929) +SketchLine_18 = Sketch_2.addLine(25, 54.20204102886701, 25, 88.202041028867) SketchLine_18.setName("SketchLine_26") SketchLine_18.result().setName("SketchLine_26") -SketchLine_19 = Sketch_2.addLine(14.99999814471567, 98.20204102886706, -15.00002220451297, 98.20204102886706) +SketchLine_19 = Sketch_2.addLine(15, 98.202041028867, -15.00000000000001, 98.20204102886699) SketchLine_19.setName("SketchLine_27") SketchLine_19.result().setName("SketchLine_27") -SketchLine_21 = Sketch_2.addLine(25, 98.20204102886706, -25, 98.20204102886706) -SketchLine_21.setName("SketchLine_15") -SketchLine_21.result().setName("SketchLine_15") -SketchLine_21.setAuxiliary(True) -SketchLine_20 = Sketch_2.addLine(25, 44.20204102886705, 25, 98.20204102886706) -SketchLine_20.setName("SketchLine_18") -SketchLine_20.result().setName("SketchLine_18") +SketchLine_20 = Sketch_2.addLine(25, 98.20204102886706, -25, 98.20204102886706) +SketchLine_20.setName("SketchLine_15") +SketchLine_20.result().setName("SketchLine_15") SketchLine_20.setAuxiliary(True) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint()) +SketchLine_21 = Sketch_2.addLine(25, 44.20204102886705, 25, 98.20204102886706) +SketchLine_21.setName("SketchLine_18") +SketchLine_21.result().setName("SketchLine_18") +SketchLine_21.setAuxiliary(True) +SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_20.startPoint()) SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_13") SketchLine_22 = Sketch_2.addLine(-25, 98.20204102886706, -25, 44.20204102886705) SketchLine_22.setName("SketchLine_16") SketchLine_22.result().setName("SketchLine_16") SketchLine_22.setAuxiliary(True) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_22.startPoint()) SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_14") SketchLine_23 = Sketch_2.addLine(-25, 44.20204102886705, 25, 44.20204102886705) SketchLine_23.setName("SketchLine_17") @@ -133,27 +139,31 @@ SketchLine_23.result().setName("SketchLine_17") SketchLine_23.setAuxiliary(True) SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint()) SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_15") -SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_23.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_23.endPoint(), SketchLine_21.startPoint()) SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_16") -SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_21.result()) +SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_20.result()) +SketchConstraintHorizontal_6.setName("SketchConstraintHorizontal_6") SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_22.result()) SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_23.result()) -SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_20.result()) -SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_21.result(), "l_percage") +SketchConstraintHorizontal_7.setName("SketchConstraintHorizontal_7") +SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_21.result()) +SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_20.result(), "l_percage") SketchConstraintLength_6.setName("SketchConstraintLength_8") -SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_20.result(), 54) +SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_21.result(), 54) SketchConstraintLength_7.setName("SketchConstraintLength_9") -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_14.result(), SketchLine_22.startPoint(), "l_percage/2") -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_19")) +SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_14.result(), SketchLine_22.startPoint(), "l_percage/2", False) +SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_19"), False) SketchLine_24 = SketchProjection_3.createdFeature() -SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_24.result(), SketchLine_21.startPoint(), 20) -SketchArc_1 = Sketch_2.addArc(-15, 54.20204102886705, -25, 54.20202402898175, -15.00002401644285, 44.20204102886705, False) -SketchLine_25 = Sketch_2.addLine(-25, 98.20204102886706, -25, 54.20202402898175) +SketchLine_24.setName("SketchLine_25") +SketchLine_24.result().setName("SketchLine_25") +SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_24.result(), SketchLine_20.startPoint(), 20, False) +SketchArc_1 = Sketch_2.addArc(-15, 54.202041028867, -25, 54.202041028867, -15, 44.202041028867, False) +SketchLine_25 = Sketch_2.addLine(-25, 98.20204102886706, -25, 54.202041028867) SketchLine_25.setName("SketchLine_22") SketchLine_25.result().setName("SketchLine_22") SketchLine_25.setAuxiliary(True) SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_25.endPoint()) -SketchLine_26 = Sketch_2.addLine(-15.00002401644285, 44.20204102886705, 25, 44.20204102886705) +SketchLine_26 = Sketch_2.addLine(-15, 44.202041028867, 25, 44.20204102886705) SketchLine_26.setName("SketchLine_21") SketchLine_26.result().setName("SketchLine_21") SketchLine_26.setAuxiliary(True) @@ -164,33 +174,33 @@ SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_23.endPoint() SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_22.startPoint(), SketchLine_25.startPoint()) SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_26.startPoint(), SketchLine_23.result()) SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_22.result()) -SketchArc_2 = Sketch_2.addArc(15, 54.20204102886705, 14.99999932366307, 44.20204102886705, 25, 54.2020551101737, False) +SketchArc_2 = Sketch_2.addArc(15, 54.20204102886701, 15, 44.20204102886701, 25, 54.20204102886701, False) SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_16.endPoint()) -SketchLine_27 = Sketch_2.addLine(25, 54.2020551101737, 25, 98.20204102886706) +SketchLine_27 = Sketch_2.addLine(25, 54.20204102886701, 25, 98.20204102886706) SketchLine_27.setName("SketchLine_23") SketchLine_27.result().setName("SketchLine_23") SketchLine_27.setAuxiliary(True) SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_27.startPoint()) SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_27.result()) SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_16.result()) -SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_27.endPoint()) SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_26.startPoint(), SketchLine_16.startPoint()) -SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_20.result()) +SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_21.result()) SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_26.result()) -SketchArc_3 = Sketch_2.addArc(15, 88.20204102886704, 25, 88.20204066628929, 14.99999814471567, 98.20204102886706, False) +SketchArc_3 = Sketch_2.addArc(15, 88.202041028867, 25, 88.202041028867, 15, 98.202041028867, False) SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_18.endPoint()) -SketchLine_28 = Sketch_2.addLine(14.99999814471567, 98.20204102886706, -25, 98.20204102886706) +SketchLine_28 = Sketch_2.addLine(15, 98.202041028867, -25, 98.20204102886706) SketchLine_28.setName("SketchLine_25") SketchLine_28.result().setName("SketchLine_25") SketchLine_28.setAuxiliary(True) SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_28.startPoint()) SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_28.result()) SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_18.result()) -SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_28.endPoint()) +SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_28.endPoint()) SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_18.startPoint()) -SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_21.result()) +SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_20.result()) SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_27.result()) -SketchArc_4 = Sketch_2.addArc(-15, 88.20204102886706, -15.00002220451297, 98.20204102886706, -25, 88.20203643108667, False) +SketchArc_4 = Sketch_2.addArc(-15, 88.20204102886699, -15.00000000000001, 98.20204102886699, -25, 88.20204102886699, False) SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchArc_4.startPoint(), SketchLine_19.endPoint()) SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_17.startPoint()) SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_19.result()) @@ -204,9 +214,9 @@ SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_4.results()[1], 10) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_2.results()[1], 10) SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_1.results()[1], 10) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_24f-SketchLine_28f-SketchLine_26f-SketchLine_27f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2f-SketchArc_4_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/To_Face_1"), -30, model.selection(), 0) -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_8"), "inclinaison") -Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle1") +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_24f-SketchArc_2_2f-SketchLine_26f-SketchArc_3_2f-SketchLine_27f-SketchArc_4_2f-SketchLine_28f-SketchArc_1_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/To_Face"), -30, model.selection(), 0) +Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_24][Extrusion_1_1/From_Face]"), "inclinaison") +Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle1") Recover_1 = model.addRecover(Part_1_doc, Rotation_2, [Rotation_1.result()]) Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle2") Rotation_3.setName("Rotation_4") @@ -219,8 +229,10 @@ Recover_3 = model.addRecover(Part_1_doc, Rotation_2, [Rotation_1.result()]) Rotation_5 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_3_1")], model.selection("EDGE", "PartSet/OZ"), "-angle1") Rotation_5.setName("Rotation_6") Rotation_5.result().setName("Rotation_6_1") -Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Rotation_4_1"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Rotation_6_1"), model.selection("SOLID", "Rotation_5_1")]) +Cut_1_objects_2 = [model.selection("SOLID", "Rotation_4_1"), model.selection("SOLID", "Rotation_2_1"), model.selection("SOLID", "Rotation_6_1"), model.selection("SOLID", "Rotation_5_1")] +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], Cut_1_objects_2) +model.do() model.end() -assert(Boolean_1.result().shapeType() == 'SOLID') +assert(Cut_1.result().shapeType() == 'SOLID') assert(Part_1_doc.size("Bodies") == 1) diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes2.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes2.py index 0bac973fc..f63005660 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes2.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes2.py @@ -18,8 +18,6 @@ ## email : webmaster.salome@opencascade.com ## -# -*- coding: utf-8 -*- - from salome.shaper import model model.begin() @@ -32,7 +30,7 @@ SketchCircle_2 = Sketch_1.addCircle(-117.8044596912521, -0.1732418524871385, 54. model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0) 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")]) +Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "Extrusion_1_1_3")]) model.do() model.end() -- 2.39.2