From dab9746bda02ffdc91bdf83f4d33027b308b4a3b Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 30 Oct 2018 18:04:58 +0300 Subject: [PATCH] Update unit tests for SketchPlugin module --- src/SketchPlugin/Test/Test2034_3.py | 6 +- src/SketchPlugin/Test/Test2119.py | 16 +-- src/SketchPlugin/Test/Test2280.py | 2 +- src/SketchPlugin/Test/Test2287.py | 6 +- src/SketchPlugin/Test/Test2341.py | 12 +-- src/SketchPlugin/Test/Test2390.py | 8 +- src/SketchPlugin/Test/Test2393.py | 4 +- src/SketchPlugin/Test/Test2440.py | 2 +- src/SketchPlugin/Test/Test2654.py | 14 +-- src/SketchPlugin/Test/TestConstraintEqual.py | 4 +- src/SketchPlugin/Test/TestEdgesOrder.py | 42 ++++---- .../Test/TestFilletAfterFolder.py | 2 +- .../Test/TestIntersectionChangeEdge.py | 28 +++--- .../Test/TestIntersectionWithCircle.py | 8 +- .../Test/TestIntersectionWithLine.py | 6 +- .../Test/TestIntersectionWithSpline.py | 20 ++-- src/SketchPlugin/Test/TestMovementComplex.py | 16 +-- .../Test/TestMultiRotationWithParameter.py | 2 +- src/SketchPlugin/Test/TestProjection.py | 6 +- .../Test/TestProjectionIntoResult.py | 99 ++++++++++++------- 20 files changed, 164 insertions(+), 139 deletions(-) diff --git a/src/SketchPlugin/Test/Test2034_3.py b/src/SketchPlugin/Test/Test2034_3.py index 632db037c..99f21766c 100644 --- a/src/SketchPlugin/Test/Test2034_3.py +++ b/src/SketchPlugin/Test/Test2034_3.py @@ -48,14 +48,14 @@ SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1. SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 10) model.do() Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ")) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), False) +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), False) SketchPoint_1 = SketchProjection_3.createdFeature() SketchArc_1 = Sketch_2.addArc(0, 5, -5, 0, 5, 0, False) SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_1.startPoint()) -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_5e"), False) +SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False) SketchPoint_2 = SketchProjection_4.createdFeature() SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates()) -SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_1e"), False) +SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False) SketchPoint_3 = SketchProjection_5.createdFeature() model.do() diff --git a/src/SketchPlugin/Test/Test2119.py b/src/SketchPlugin/Test/Test2119.py index 1c949e8cb..9cedb1611 100644 --- a/src/SketchPlugin/Test/Test2119.py +++ b/src/SketchPlugin/Test/Test2119.py @@ -86,24 +86,24 @@ SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 10) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.coordinates()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchArc_1_2r-SketchArc_2_2r")], model.selection(), "b/2", "b/2") -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchArc_2_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchArc_1_2r-SketchLine_10f")], model.selection(), "b/2", "b/2") +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) +SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"), False) SketchPoint_2 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_2.addCircle(-15, 35, 25) SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchPoint_2.result()) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_1.results()[1], "50/2") model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_4")) -SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"), False) +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f_wire")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")]) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "_weak_name_6_ExtrusionCut_1_1")) +SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9][_weak_name_6_ExtrusionCut_1_1]"), False) SketchPoint_3 = SketchProjection_2.createdFeature() -SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"), False) +SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_9][_weak_name_6_ExtrusionCut_1_1]"), False) SketchLine_11 = SketchProjection_3.createdFeature() SketchArc_3 = Sketch_3.addArc(-15, 35, -15, 46.0103340429751, -17.02045759563166, 24.17663606626138, True) SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchPoint_3.result(), SketchArc_3.center()) SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_11.result(), SketchArc_3.startPoint()) -SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), False) +SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_1_2][_weak_name_6_ExtrusionCut_1_1]"), False) SketchArc_4 = SketchProjection_4.createdFeature() SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1]) SketchLine_12 = Sketch_3.addLine(-15, 46.0103340429751, -15, 35) diff --git a/src/SketchPlugin/Test/Test2280.py b/src/SketchPlugin/Test/Test2280.py index d96bf8aac..980d684ee 100644 --- a/src/SketchPlugin/Test/Test2280.py +++ b/src/SketchPlugin/Test/Test2280.py @@ -32,7 +32,7 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True) SketchCircle_1 = SketchProjection_1.createdFeature() SketchCircle_2 = Sketch_1.addCircle(0.0, 10.0, 8.0) model.do() diff --git a/src/SketchPlugin/Test/Test2287.py b/src/SketchPlugin/Test/Test2287.py index 1049f7d1c..f812ec934 100644 --- a/src/SketchPlugin/Test/Test2287.py +++ b/src/SketchPlugin/Test/Test2287.py @@ -28,13 +28,13 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(-20, -62, 81, 60) model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), True) +SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), True) SketchLine_2 = SketchProjection_1.createdFeature() model.do() -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchProjection_1")]) +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchProjection_1")]) model.end() # before bug fix it was "Sketch_2" -assert(Edge_1.baseObjects().value(0).namingName() == "Sketch_2/Edge-SketchProjection_1") +assert(Edge_1.baseObjects().value(0).namingName() == "Sketch_2/SketchProjection_1") assert(model.checkPythonDump()) diff --git a/src/SketchPlugin/Test/Test2341.py b/src/SketchPlugin/Test/Test2341.py index a62144360..337a82cb9 100644 --- a/src/SketchPlugin/Test/Test2341.py +++ b/src/SketchPlugin/Test/Test2341.py @@ -112,13 +112,13 @@ SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_3.endPoint(), Sketch SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_9.result(), 20) SketchConstraintLength_6.setName("SketchConstraintLength_8") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6r-SketchLine_7r-SketchLine_8f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2r-SketchLine_11f-SketchLine_12r")], model.selection(), 3.5, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3")) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_2_2f-SketchLine_11f-SketchArc_3_2r-SketchLine_12r-SketchLine_7r-SketchLine_6r-SketchLine_8f-SketchArc_1_2f")], model.selection(), 3.5, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6")) SketchLine_14 = Sketch_2.addLine(6, 0, -6, 0) -SketchProjection_8 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_7s-SketchLine_6e"), False) +SketchProjection_8 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_6_EndVertex"), False) SketchPoint_7 = SketchProjection_8.createdFeature() SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_7.result()) -SketchProjection_9 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_8s"), False) +SketchProjection_9 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_6_StartVertex"), False) SketchPoint_8 = SketchProjection_9.createdFeature() SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_8.result()) SketchLine_15 = Sketch_2.addLine(-6, 0, -6, -3.5) @@ -126,14 +126,14 @@ SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_14.endPoint() SketchLine_16 = Sketch_2.addLine(-6, -3.5, -6, -10.5) SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) SketchLine_17 = Sketch_2.addLine(5.978225648847096, 0.08643259872215214, 6, -3.5) -SketchProjection_10 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False) +SketchProjection_10 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) SketchPoint_9 = SketchProjection_10.createdFeature() SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchPoint_9.result()) SketchLine_18 = Sketch_2.addLine(6, -3.5, 6, -10.5) SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_18.result(), 7) SketchConstraintLength_7.setName("SketchConstraintLength_9") -SketchProjection_11 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False) +SketchProjection_11 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/To_Face]"), False) SketchPoint_10 = SketchProjection_11.createdFeature() SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_10).coordinates(), SketchLine_15.endPoint()) SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_18.result()) diff --git a/src/SketchPlugin/Test/Test2390.py b/src/SketchPlugin/Test/Test2390.py index 1739cbe66..d0f4b6f67 100644 --- a/src/SketchPlugin/Test/Test2390.py +++ b/src/SketchPlugin/Test/Test2390.py @@ -93,11 +93,11 @@ SketchConstraintVertical_15 = Sketch_4.setVertical(SketchLine_52.result()) SketchConstraintVertical_16 = Sketch_4.setVertical(SketchLine_55.result()) SketchConstraintVertical_17 = Sketch_4.setVertical(SketchLine_58.result()) SketchConstraintHorizontal_11 = Sketch_4.setHorizontal(SketchLine_56.result()) -SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5e"), False) +SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"), False) SketchPoint_4 = SketchProjection_13.createdFeature() SketchConstraintDistanceHorizontal_17 = Sketch_4.setHorizontalDistance(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_52.endPoint(), "Drill2_Loc") SketchConstraintLength_3 = Sketch_4.setLength(SketchLine_54.result(), "Drill2_InnerRadius") -SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False) +SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False) SketchLine_59 = SketchProjection_14.createdFeature() SketchConstraintAngle_6 = Sketch_4.setAngle(SketchLine_57.result(), SketchLine_56.result(), 45) SketchConstraintLength_4 = Sketch_4.setLength(SketchLine_56.result(), "Drill2_Radius") @@ -111,7 +111,7 @@ SketchConstraintDistance_14 = Sketch_4.setDistance(SketchLine_57.endPoint(), Ske SketchConstraintTangent_3 = Sketch_4.setTangent(SketchLine_58.result(), SketchArc_2.results()[1]) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_9r-SketchLine_10r-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchArc_1_2f")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), 360, 0) +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchArc_1_2f-SketchLine_10r-SketchLine_9r-SketchLine_7r")], model.selection("EDGE", "Sketch_2/SketchLine_7"), 360, 0) model.do() from GeomAPI import GeomAPI_Shape @@ -157,4 +157,4 @@ model.testResultsVolumes(Revolution_1, [41.691543241529835484016075497], SIGNIFI model.end() # TODO: uncomment following line when issue #2389 is fixed -#assert(model.checkPythonDump()) \ No newline at end of file +#assert(model.checkPythonDump()) diff --git a/src/SketchPlugin/Test/Test2393.py b/src/SketchPlugin/Test/Test2393.py index 0fc461049..09a224557 100644 --- a/src/SketchPlugin/Test/Test2393.py +++ b/src/SketchPlugin/Test/Test2393.py @@ -38,7 +38,7 @@ Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Top"), 10, Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), True) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), True) SketchLine_1 = SketchProjection_2.createdFeature() SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 3) [SketchLine_1, SketchLine_2, SketchLine_3] = SketchMultiRotation_1.rotated() @@ -54,4 +54,4 @@ model.checkSketch(Sketch_1, 0) model.end() -assert(model.checkPythonDump()) \ No newline at end of file +assert(model.checkPythonDump()) diff --git a/src/SketchPlugin/Test/Test2440.py b/src/SketchPlugin/Test/Test2440.py index eb4077a58..0197e4ab8 100644 --- a/src/SketchPlugin/Test/Test2440.py +++ b/src/SketchPlugin/Test/Test2440.py @@ -44,7 +44,7 @@ Import_1.result().setName("profile_top_1") Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchLine_1 = Sketch_1.addLine(-0.5, 0, -0.1, 0.5) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "profile_top_1/Shape2"), False) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "profile_top_1/Shape_2"), False) SketchPoint_1 = SketchProjection_1.createdFeature() model.do() diff --git a/src/SketchPlugin/Test/Test2654.py b/src/SketchPlugin/Test/Test2654.py index 066d5e292..f78931992 100644 --- a/src/SketchPlugin/Test/Test2654.py +++ b/src/SketchPlugin/Test/Test2654.py @@ -113,13 +113,13 @@ SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_1.startPoint( SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_23") SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_11.result(), SketchArc_2.startPoint(), 7.37, True) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchArc_1_2r-SketchArc_2_2f-SketchArc_3_2f")], model.selection(), "h", 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3")) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_3_2f-SketchLine_10r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchArc_2_2f")], model.selection(), "h", 0) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7")) +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/From_Face]"), False) SketchPoint_2 = SketchProjection_3.createdFeature() -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False) +SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"), False) SketchPoint_3 = SketchProjection_4.createdFeature() -SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False) +SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"), False) SketchPoint_4 = SketchProjection_5.createdFeature() SketchLine_13 = Sketch_2.addLine(6.005577592461473, 0, -5.994422407538528, 0) SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_13.startPoint()) @@ -129,7 +129,7 @@ SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_26") SketchLine_14 = Sketch_2.addLine(-5.994422407538528, 0, -5.994422407538528, -3.5) SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_27") -SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False) +SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False) SketchPoint_5 = SketchProjection_6.createdFeature() SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_5.result()) SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_28") @@ -161,7 +161,7 @@ SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_17.result()) SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_17.result(), 7) SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_17.result(), SketchLine_15.result()) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16r-SketchLine_17r-SketchArc_5_2f")], model.selection(), "h", 0) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchArc_5_2f-SketchLine_17r-SketchLine_16r")], model.selection(), "h", 0) model.do() diff --git a/src/SketchPlugin/Test/TestConstraintEqual.py b/src/SketchPlugin/Test/TestConstraintEqual.py index cd5bf4b68..1251e564e 100644 --- a/src/SketchPlugin/Test/TestConstraintEqual.py +++ b/src/SketchPlugin/Test/TestConstraintEqual.py @@ -147,7 +147,7 @@ anExtCircleCenter = geomDataAPI_Point2D(anExtCircle.attribute("circle_center")) anExtCircleRadius = anExtCircle.real("circle_radius") anExtCircleCenter.setValue(-50., 50.) anExtCircleRadius.setValue(10.) -anExtCircle.selection("External").selectSubShape("EDGE", "Sketch_1/Edge-SketchCircle_1_2") +anExtCircle.selection("External").selectSubShape("EDGE", "Sketch_1/SketchCircle_1_2") aSession.finishOperation() assert (model.dof(aSketchFeature) == 7) aSession.startOperation() @@ -212,7 +212,7 @@ anExtLineStart = geomDataAPI_Point2D(anExtLine.attribute("StartPoint")) anExtLineEnd = geomDataAPI_Point2D(anExtLine.attribute("EndPoint")) anExtLineStart.setValue(-40., 35.) anExtLineEnd.setValue(-60., 25.) -anExtLine.selection("External").selectSubShape("EDGE", "Sketch_1/Edge-SketchLine_1") +anExtLine.selection("External").selectSubShape("EDGE", "Sketch_1/SketchLine_1") anExtLineLen = lineLength(anExtLine) aSession.finishOperation() assert (model.dof(aSketchFeature) == 13) diff --git a/src/SketchPlugin/Test/TestEdgesOrder.py b/src/SketchPlugin/Test/TestEdgesOrder.py index cc8ae38a7..5a53a81f0 100644 --- a/src/SketchPlugin/Test/TestEdgesOrder.py +++ b/src/SketchPlugin/Test/TestEdgesOrder.py @@ -55,26 +55,26 @@ Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint()) Sketch_1.setLength(SketchLine_1.result(), 20) Sketch_1.setLength(SketchLine_2.result(), 40) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")], model.selection(), 10, 0) # Extrude all lateral faces to check their area Extrusion_2 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1")) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2")) SketchLine_5 = Sketch_2.addLine(0.7346748749771982, 2.736245541082907e-015, 0.7346748749771982, 10.00000000000001) -SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False) +SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchPoint_1.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False) +SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) SketchPoint_2 = SketchProjection_2.createdFeature() SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchPoint_2.result()) SketchLine_6 = Sketch_2.addLine(0.7346748749771982, 10.00000000000001, -19.2653251250228, 10.00000000000001) SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False) +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) SketchPoint_3 = SketchProjection_3.createdFeature() SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchPoint_3.result()) SketchLine_7 = Sketch_2.addLine(-19.2653251250228, 10.00000000000001, -19.2653251250228, 2.775557561562891e-015) SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) -SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False) +SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False) SketchPoint_4 = SketchProjection_4.createdFeature() SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_4.result()) SketchLine_8 = Sketch_2.addLine(-19.2653251250228, 2.775557561562891e-015, 0.7346748749771974, 3.386180225106727e-015) @@ -83,22 +83,22 @@ SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_5.startPoint( Extrusion_2.setNestedSketch(Sketch_2) Extrusion_3 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2")) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")) SketchLine_9 = Sketch_3.addLine(36.86324678550901, 2.286454635368208e-015, 36.86324678550901, 10) -SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False) +SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False) SketchPoint_5 = SketchProjection_5.createdFeature() SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchPoint_5.result()) -SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False) +SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) SketchPoint_6 = SketchProjection_6.createdFeature() SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchPoint_6.result()) SketchLine_10 = Sketch_3.addLine(36.86324678550901, 10, -3.136753214490995, 10) SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) -SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False) +SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) SketchPoint_7 = SketchProjection_7.createdFeature() SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchPoint_7.result()) SketchLine_11 = Sketch_3.addLine(-3.136753214490995, 10, -3.136753214490995, 2.275957200481571e-015) SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False) +SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"), False) SketchPoint_8 = SketchProjection_8.createdFeature() SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_8.result()) SketchLine_12 = Sketch_3.addLine(-3.136753214490995, 2.275957200481571e-015, 36.86324678550902, 1.387778780781446e-015) @@ -107,22 +107,22 @@ SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_9.startPoint( Extrusion_3.setNestedSketch(Sketch_3) Extrusion_4 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) -Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3")) +Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")) SketchLine_13 = Sketch_4.addLine(22.60959895285982, 4.420942808558057e-016, 22.60959895285982, 10) -SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False) +SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"), False) SketchPoint_9 = SketchProjection_9.createdFeature() SketchConstraintCoincidence_21 = Sketch_4.setCoincident(SketchLine_13.startPoint(), SketchPoint_9.result()) -SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False) +SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) SketchPoint_10 = SketchProjection_10.createdFeature() SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchLine_13.endPoint(), SketchPoint_10.result()) SketchLine_14 = Sketch_4.addLine(22.60959895285982, 10, -7.390401047140179, 10) SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) -SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False) +SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False) SketchPoint_11 = SketchProjection_11.createdFeature() SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_14.endPoint(), SketchPoint_11.result()) SketchLine_15 = Sketch_4.addLine(-7.390401047140179, 10, -7.390401047140179, 8.881784197001252e-016) SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) -SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False) +SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), False) SketchPoint_12 = SketchProjection_12.createdFeature() SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_15.endPoint(), SketchPoint_12.result()) SketchLine_16 = Sketch_4.addLine(-7.390401047140179, 8.881784197001252e-016, 22.60959895285983, 0) @@ -131,22 +131,22 @@ SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchLine_13.startPoint Extrusion_4.setNestedSketch(Sketch_4) Extrusion_5 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0) -Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4")) +Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5")) SketchLine_17 = Sketch_5.addLine(-10.64977324988603, -1.185841873934692e-016, -10.64977324988603, -10) -SketchProjection_13 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False) +SketchProjection_13 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), False) SketchPoint_13 = SketchProjection_13.createdFeature() SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchLine_17.startPoint(), SketchPoint_13.result()) -SketchProjection_14 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False) +SketchProjection_14 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False) SketchPoint_14 = SketchProjection_14.createdFeature() SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_17.endPoint(), SketchPoint_14.result()) SketchLine_18 = Sketch_5.addLine(-10.64977324988603, -10, 39.35022675011398, -10) SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint()) -SketchProjection_15 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False) +SketchProjection_15 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) SketchPoint_15 = SketchProjection_15.createdFeature() SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_18.endPoint(), SketchPoint_15.result()) SketchLine_19 = Sketch_5.addLine(39.35022675011398, -10, 39.35022675011398, 4.440892098500626e-016) SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint()) -SketchProjection_16 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False) +SketchProjection_16 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False) SketchPoint_16 = SketchProjection_16.createdFeature() SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_19.endPoint(), SketchPoint_16.result()) SketchLine_20 = Sketch_5.addLine(39.35022675011398, 4.440892098500626e-016, -10.64977324988603, 0) diff --git a/src/SketchPlugin/Test/TestFilletAfterFolder.py b/src/SketchPlugin/Test/TestFilletAfterFolder.py index 557b74daa..27f2ff5f1 100644 --- a/src/SketchPlugin/Test/TestFilletAfterFolder.py +++ b/src/SketchPlugin/Test/TestFilletAfterFolder.py @@ -48,7 +48,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Size") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "Size") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), "Size", 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), "Size", 0) Folder_1 = model.addFolder(Part_1_doc, Sketch_1, Extrusion_1) model.do() diff --git a/src/SketchPlugin/Test/TestIntersectionChangeEdge.py b/src/SketchPlugin/Test/TestIntersectionChangeEdge.py index b6ef8dc27..07f2831cd 100644 --- a/src/SketchPlugin/Test/TestIntersectionChangeEdge.py +++ b/src/SketchPlugin/Test/TestIntersectionChangeEdge.py @@ -51,11 +51,11 @@ SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.center(), Ske SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 60) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchArc_2_2f-SketchLine_1f-SketchLine_2r")], model.selection(), 50, 50) -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1")]) -Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchArc_2_2f-SketchLine_2r-SketchArc_1_2r")], model.selection(), 50, 50) +Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/To_Face]")]) +Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/From_Face]"), False) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1-SketchArc_2-SketchProjection_1-SketchPoint_1"), False) +SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False) SketchPoint_2 = SketchProjection_2.createdFeature() SketchLine_3 = Sketch_2.addLine(-70, 60, 70, 60) SketchLine_4 = Sketch_2.addLine(70, 60, 70, -60) @@ -74,19 +74,19 @@ SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2) SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 70, True) SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 70, True) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r")]) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")]) Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("FACE", "Filling_1_1"), model.selection("FACE", "Face_1_1")]) # set different edges used for intersection and check reference data: number of intersection points and their coordinates -REF_DATA = [("Sketch_1/Edge-SketchArc_1_2", 1, [[30, 0]]), - ("Sketch_1/Edge-SketchLine_2", 1, [[-36.024358588836, 0]]), - ("Sketch_1/Edge-SketchArc_2_2", 2, [[60, 0], [-60, 0]]), - ("Sketch_1/Edge-SketchLine_1", 0, []), - ("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1", 1, [[30, 50]]), - ("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1", 1, [[-36.024358588836, 50]]), - ("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1", 2, [[60, 50], [-60, 50]]), - ("Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1", 0, []), - ("Intersection_1_1", 2, [[-0.0515933488223, -11.6181750315], [41.6438615258, -11.6181750315]])] +REF_DATA = [("Sketch_1/SketchArc_1_2", 1, [[30, 0]]), + ("Sketch_1/SketchLine_2", 1, [[-36.024358588836, 0]]), + ("Sketch_1/SketchArc_2_2", 2, [[60, 0], [-60, 0]]), + ("Sketch_1/SketchLine_1", 0, []), + ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]", 1, [[30, 50]]), + ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]", 1, [[-36.024358588836, 50]]), + ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/To_Face]", 2, [[60, 50], [-60, 50]]), + ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]", 0, []), + ("Intersection_1_1", 2, [[41.6438615258, -11.6181750315], [-0.0515933488223, -11.6181750315]])] TOLERANCE = 1.e-7 Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) diff --git a/src/SketchPlugin/Test/TestIntersectionWithCircle.py b/src/SketchPlugin/Test/TestIntersectionWithCircle.py index 47237e813..22f0dfc0b 100644 --- a/src/SketchPlugin/Test/TestIntersectionWithCircle.py +++ b/src/SketchPlugin/Test/TestIntersectionWithCircle.py @@ -56,10 +56,10 @@ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 50) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 10) SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_2.result(), 19, True) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2r")], model.selection(), 10, 0) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), "D", True) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2r")], model.selection(), 10, 0) +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), "D", True) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1")) -SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), True) +SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"), True) SketchIntersectionPoint_1.result().setName("SketchIntersectionPoint_1") [SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints() SketchCircle_1 = Sketch_2.addCircle(38.14142842854285, 10, 1) @@ -83,7 +83,7 @@ SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchArc_2.startPoint(), 5) SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_6.result()) model.do() -RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchArc_2_2f")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), 360, 0, [model.selection("SOLID", "Extrusion_1_1")]) +RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_6r-SketchArc_2_2f-SketchLine_5r")], model.selection("EDGE", "Sketch_2/SketchLine_5"), 360, 0, [model.selection("SOLID", "Extrusion_1_1")]) ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), 5, 5, [model.selection("SOLID", "RevolutionCut_1_1")]) model.do() diff --git a/src/SketchPlugin/Test/TestIntersectionWithLine.py b/src/SketchPlugin/Test/TestIntersectionWithLine.py index a6b163ca2..36bcc53ae 100644 --- a/src/SketchPlugin/Test/TestIntersectionWithLine.py +++ b/src/SketchPlugin/Test/TestIntersectionWithLine.py @@ -67,10 +67,10 @@ SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_2.result(), 10) SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_4.startPoint(), "D") SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_7.startPoint(), 40, True) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 0) ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 5, 5, [model.selection("SOLID", "Extrusion_1_1")]) -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_5")) -SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1")) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")) +SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"), False) [SketchPoint_2] = SketchIntersectionPoint_1.intersectionPoints() SketchCircle_1 = Sketch_2.addCircle(40, 10, 5) SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_1.center()) diff --git a/src/SketchPlugin/Test/TestIntersectionWithSpline.py b/src/SketchPlugin/Test/TestIntersectionWithSpline.py index a3f396566..44e1eda7b 100644 --- a/src/SketchPlugin/Test/TestIntersectionWithSpline.py +++ b/src/SketchPlugin/Test/TestIntersectionWithSpline.py @@ -50,9 +50,9 @@ SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 65) SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchAPI_Line(SketchLine_3).startPoint(), 20) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 55) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f-SketchLine_2f")], model.selection(), 25, 25) -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1")]) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f-SketchLine_2f")]) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f-SketchLine_2f")], model.selection(), 25, 25) +Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]")]) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f-SketchLine_2f")]) Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("FACE", "Filling_1_1"), model.selection("FACE", "Face_1_1")]) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_4 = Sketch_2.addLine(-34.11217447219568, 40, 20, -37.28019411294778) @@ -70,9 +70,9 @@ SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1) SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "D", True) SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_5.result(), SketchLine_4.result(), 35) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 10, 10) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchLine_6f")], model.selection(), 10, 10) ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection(), 10, 0, [model.selection("SOLID", "Extrusion_2_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face_3")) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_4")) SketchIntersectionPoint_1 = Sketch_3.addIntersectionPoint(model.selection("EDGE", "Intersection_1_1"), False) [SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints() SketchCircle_1 = Sketch_3.addCircle(-33.22640570408476, 0, 5) @@ -115,12 +115,12 @@ model.do(); assert(SketchIntersectionPoint_1.feature().results().size() == 1) model.testNbResults(ExtrusionFuse_1, 1) -model.testNbSubResults(ExtrusionFuse_1, [1]) +model.testNbSubResults(ExtrusionFuse_1, [0]) model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.SOLID, [1]) -model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.FACE, [11]) -model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.EDGE, [42]) -model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.VERTEX, [84]) -model.testResultsVolumes(ExtrusionFuse_1, [89224.362837261898675933480262756]) +model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.FACE, [9]) +model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.EDGE, [30]) +model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.VERTEX, [60]) +model.testResultsVolumes(ExtrusionFuse_1, [89638.890852351003559306263923645]) # change parameter and check intersection is NOT valid now ParamD.setValue(50) diff --git a/src/SketchPlugin/Test/TestMovementComplex.py b/src/SketchPlugin/Test/TestMovementComplex.py index 228f50427..f1c0840df 100644 --- a/src/SketchPlugin/Test/TestMovementComplex.py +++ b/src/SketchPlugin/Test/TestMovementComplex.py @@ -202,7 +202,7 @@ for i in range(1, 10): assert(model.dof(Sketch_1) == 0) # Extrude main part of clamp -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchArc_1_2f-SketchCircle_1_2r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchArc_1_2f-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r-SketchCircle_1_2r")], model.selection(), 10, 0) model.do() @@ -210,7 +210,7 @@ model.do() Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchRectangle_1 = Sketch_2.addRectangle(20, 0, 100, 50) [SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9] = SketchRectangle_1.lines() -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")) SketchLine_10 = SketchProjection_1.createdFeature() SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_7).startPoint(), SketchAPI_Line(SketchLine_10).startPoint()) SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_8.result(), SketchLine_10.result()) @@ -337,12 +337,12 @@ SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], 6.5) SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_2.center(), SketchLine_8.result(), 30) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchCircle_2_2r-SketchArc_2_2r-SketchLine_13r-SketchLine_14f-SketchLine_15f-SketchArc_3_2r-SketchLine_16r")], model.selection(), -165, 155) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_14f-SketchLine_16r-SketchArc_3_2r-SketchLine_15f-SketchLine_13r-SketchArc_2_2r-SketchCircle_2_2r")], model.selection(), -165, 155) Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")]) -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Fuse_1_1/Modified_Face_2")) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7)")) SketchLine_17 = Sketch_3.addLine(145, 0, 165, 0) -SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "Fuse_1_1/Modified_Face_divided_6_1&Fuse_1_1/Modified_Face_3&Fuse_1_1/Modified_Face_divided_5_1")) +SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Extrusion_1_1/From_Face&Sketch_2/SketchLine_6][Fuse_1_1/Modified_Face&Sketch_1/SketchLine_1&Extrusion_2_1/To_Face][Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7]")) SketchPoint_2 = SketchProjection_2.createdFeature() SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchAPI_Point(SketchPoint_2).result()) SketchLine_18 = Sketch_3.addLine(165, 0, 165, -20) @@ -365,12 +365,12 @@ SketchArc_5 = Sketch_3.addArc(145, -20, 155, -20, 145, -10, False) SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchArc_5.center()) SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_20.result(), SketchArc_5.endPoint()) SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchArc_5.startPoint(), SketchLine_19.result()) -SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "Fuse_1_1/Modified_Face_4&Fuse_1_1/Modified_Face_divided_2_1")) +SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face][(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)(Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7)]")) SketchConstraintTangent_5 = Sketch_3.setTangent(SketchArc_5.results()[1], SketchLine_21.result()) model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_17r-SketchLine_18r-SketchArc_4_2r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face_divided_1_1"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")]) -ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_19r-SketchLine_20r-SketchArc_4_2f-SketchArc_5_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2r-SketchLine_18r-SketchLine_17r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_1/SketchLine_2&Sketch_2/SketchLine_9"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")]) +ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2f-SketchLine_20r-SketchArc_5_2r-SketchLine_19r")], model.selection(), model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) model.do() model.end() diff --git a/src/SketchPlugin/Test/TestMultiRotationWithParameter.py b/src/SketchPlugin/Test/TestMultiRotationWithParameter.py index d69ce986b..9acedebaa 100644 --- a/src/SketchPlugin/Test/TestMultiRotationWithParameter.py +++ b/src/SketchPlugin/Test/TestMultiRotationWithParameter.py @@ -47,7 +47,7 @@ SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/O SketchPoint_1 = SketchProjection_1.createdFeature() model.do() SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_2.result()], SketchAPI_Point(SketchPoint_1).coordinates(), "360/N", "N") -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0) model.do() # change parameters diff --git a/src/SketchPlugin/Test/TestProjection.py b/src/SketchPlugin/Test/TestProjection.py index 7e24e3ed5..d8dc75f50 100644 --- a/src/SketchPlugin/Test/TestProjection.py +++ b/src/SketchPlugin/Test/TestProjection.py @@ -94,17 +94,17 @@ aSession.finishOperation() #========================================================================= aSession.startOperation() aLineProjector = aSketchFeature.addFeature("SketchProjection") -aLineProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchLine_1") +aLineProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchLine_1") aLineProjector.boolean("IncludeToResult").setValue(False) aLineProjector.execute() aCircleProjector = aSketchFeature.addFeature("SketchProjection") -aCircleProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchCircle_1_2") +aCircleProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchCircle_1_2") aCircleProjector.boolean("IncludeToResult").setValue(False) aCircleProjector.execute() anArcProjector = aSketchFeature.addFeature("SketchProjection") -anArcProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchArc_1_2") +anArcProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchArc_1_2") anArcProjector.boolean("IncludeToResult").setValue(False) anArcProjector.execute() aSession.finishOperation() diff --git a/src/SketchPlugin/Test/TestProjectionIntoResult.py b/src/SketchPlugin/Test/TestProjectionIntoResult.py index adfd8ebcc..d5f43d158 100644 --- a/src/SketchPlugin/Test/TestProjectionIntoResult.py +++ b/src/SketchPlugin/Test/TestProjectionIntoResult.py @@ -1,3 +1,28 @@ +## Copyright (C) 2014-2017 CEA/DEN, EDF R&D +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +## +## See http:##www.salome-platform.org/ or +## email : webmaster.salome@opencascade.com +## + +""" + TestProjectionIntoResult.py + Unit test of SketchPlugin_Projection class +""" + from salome.shaper import model from GeomAPI import * @@ -66,75 +91,75 @@ SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_7.endPoint()) SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_7.result()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_2r-SketchLine_5r-SketchLine_6r-SketchLine_7r")], model.selection(), 100, 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_2r")], model.selection(), 100, 0) model.do() #============================================================================== # Tests #============================================================================== -aProjectedList = [("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), - ("EDGE", "Sketch_1/Edge-SketchArc_1_2"), - ("EDGE", "Sketch_1/Edge-SketchLine_1"), - ("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), +aProjectedList = [("EDGE", "Sketch_1/SketchCircle_1_2"), + ("EDGE", "Sketch_1/SketchArc_1_2"), + ("EDGE", "Sketch_1/SketchLine_1"), + ("VERTEX", "Sketch_1/SketchPoint_1"), # - ("VERTEX", "Sketch_1/Vertex-SketchCircle_1"), - ("VERTEX", "Sketch_1/Vertex-SketchLine_1e"), - ("VERTEX", "Sketch_1/Vertex-SketchLine_1s"), - ("VERTEX", "Sketch_1/Vertex-SketchArc_1_2s"), - ("VERTEX", "Sketch_1/Vertex-SketchArc_1_2e"), - ("VERTEX", "Sketch_1/Vertex-SketchArc_1"), + ("VERTEX", "Sketch_1/SketchCircle_1_2__cc"), + ("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), + ("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), + ("VERTEX", "Sketch_1/SketchArc_1_2_StartVertex"), + ("VERTEX", "Sketch_1/SketchArc_1_2_EndVertex"), + ("VERTEX", "Sketch_1/SketchArc_1"), # - ("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), - ("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), - ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), - ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), - ("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), - ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), - ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), - ("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), + ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"), + ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/From_Face]"), + ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"), + ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"), + ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"), + ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"), + ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/To_Face]"), + ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/To_Face]"), # - ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), - ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), - ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), - ("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/From_Face]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/From_Face]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"), # - ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_3"), - ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/Generated_Face_2"), - ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1"), - ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6]"), # - ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), - ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), - ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"), - ("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1") + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/To_Face]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/To_Face]"), + ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/To_Face]") ] # Test projection to the same plane -Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2")) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5")) aFailedIDs = set([21, 29]) testProjections(Part_1_doc, Sketch_3, aProjectedList, aFailedIDs) # Test projection to parallel plane -Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4")) +Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7")) testProjections(Part_1_doc, Sketch_4, aProjectedList, aFailedIDs) # Test projection to lower base of the prism -Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1")) +Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face")) aFailedIDs = set([0, 1, 22, 23, 24, 25]) testProjections(Part_1_doc, Sketch_5, aProjectedList, aFailedIDs) # Test projection to upper base of the prism -Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1")) +Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) testProjections(Part_1_doc, Sketch_6, aProjectedList, aFailedIDs) # Test projection to orthogonal side face of the prism -Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3")) +Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6")) aFailedIDs = set([0, 1, 18, 20, 26, 28]) testProjections(Part_1_doc, Sketch_7, aProjectedList, aFailedIDs) # Test projection to slope side face of the prism -Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1")) +Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2")) aFailedIDs = set([0, 1]) testProjections(Part_1_doc, Sketch_8, aProjectedList, aFailedIDs) -- 2.39.2