From d11ccbc4ac4680ea00d988afa27e4588b575bcc6 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 2 Nov 2018 15:59:39 +0300 Subject: [PATCH] Update unit tests for BuildPlugin module --- src/BuildPlugin/Test/Test1920.py | 8 ++--- src/BuildPlugin/Test/Test2398.py | 4 +-- src/BuildPlugin/Test/Test2415.py | 6 ++-- src/BuildPlugin/Test/Test2454.py | 4 +-- src/BuildPlugin/Test/TestCompSolid.py | 40 +++++++++++------------ src/BuildPlugin/Test/TestCompound.py | 18 +++++----- src/BuildPlugin/Test/TestFace.py | 2 +- src/BuildPlugin/Test/TestInterpolation.py | 26 +++++++-------- src/BuildPlugin/Test/TestPolyline.py | 20 ++++++------ src/BuildPlugin/Test/TestSolid.py | 38 ++++++++++----------- src/BuildPlugin/Test/TestSubShapes.py | 6 ++-- src/BuildPlugin/Test/TestWire.py | 14 ++++---- 12 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/BuildPlugin/Test/Test1920.py b/src/BuildPlugin/Test/Test1920.py index 96f8eb6dc..112c28338 100644 --- a/src/BuildPlugin/Test/Test1920.py +++ b/src/BuildPlugin/Test/Test1920.py @@ -41,10 +41,10 @@ SketchLine_5 = Sketch_1.addLine(50, 50, 50, 0) SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result()) SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result()) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r")]) -Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_5f")]) +Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r_wire")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")]) Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OY"), 100) -Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Translation_1_1/Translated_Edge_1"), model.selection("EDGE", "Translation_1_1/Translated_Edge_2"), model.selection("EDGE", "Translation_1_1/Translated_Edge_3"), model.selection("EDGE", "Translation_1_1/Translated_Edge_4"), model.selection("EDGE", "Translation_1_2/Translated_Edge_1"), model.selection("EDGE", "Translation_1_2/Translated_Edge_2"), model.selection("EDGE", "Translation_1_2/Translated_Edge_3"), model.selection("EDGE", "Translation_1_2/Translated_Edge_4")]) +Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_4"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_3"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_2"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_1"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_4"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_3"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_2"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_1")]) aGroupFeature = Group_1.feature() aSelectionList = aGroupFeature.selectionList("group_list") model.end() @@ -56,4 +56,4 @@ for index in range(0, aSelectionList.size()): assert(shape.isEdge()) assert(name) -assert(model.checkPythonDump()) \ No newline at end of file +assert(model.checkPythonDump()) diff --git a/src/BuildPlugin/Test/Test2398.py b/src/BuildPlugin/Test/Test2398.py index 2331d8722..12d8417f1 100644 --- a/src/BuildPlugin/Test/Test2398.py +++ b/src/BuildPlugin/Test/Test2398.py @@ -34,7 +34,7 @@ SketchCircle_1 = Sketch_1.addCircle(0, 0, 30.79356776198042) SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 100, 100) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2f_wire")], model.selection(), 100, 100) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) @@ -72,7 +72,7 @@ SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_5.result(), Sk SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_5.result()) model.do() -Edge_1_objects = [model.selection("EDGE", "Sketch_3/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_3")] +Edge_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_2"), model.selection("EDGE", "Sketch_3/SketchLine_1"), model.selection("EDGE", "Sketch_3/SketchLine_4"), model.selection("EDGE", "Sketch_3/SketchLine_3")] Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", "PartSet/OZ"), 135) diff --git a/src/BuildPlugin/Test/Test2415.py b/src/BuildPlugin/Test/Test2415.py index 64e30318c..8d1b283e7 100644 --- a/src/BuildPlugin/Test/Test2415.py +++ b/src/BuildPlugin/Test/Test2415.py @@ -52,10 +52,10 @@ SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 80) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 150) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchArc_1_2r")], model.selection(), 200, 0) -Compound_1_objects = [model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4")] +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 200, 0) +Compound_1_objects = [model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5")] Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects) -Compound_2_objects = [model.selection("EDGE", "Compound_1_1_2/Modified_Edge_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Compound_1_1_3/Modified_Edge_2")] +Compound_2_objects = [model.selection("EDGE", "[Compound_1_1_2/Compound_1_1_2&Sketch_1/SketchLine_4][weak_name_4]"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "[Compound_1_1_3/Compound_1_1_3&Sketch_1/SketchLine_5][weak_name_4]")] Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects) model.do() diff --git a/src/BuildPlugin/Test/Test2454.py b/src/BuildPlugin/Test/Test2454.py index f56d1d122..7792bf2a3 100644 --- a/src/BuildPlugin/Test/Test2454.py +++ b/src/BuildPlugin/Test/Test2454.py @@ -27,11 +27,11 @@ Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchCircle_1 = Sketch_1.addCircle(0.1822176134072968, -1.34047565209109, 35.08968954114807) model.do() -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")]) +Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")]) Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0) Recover_1 = model.addRecover(Part_1_doc, Extrusion_1, [Wire_1.result()]) Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Recover_1_1")]) -Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/To_Edge_1")]) +Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/To_Edge")]) Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")]) model.end() diff --git a/src/BuildPlugin/Test/TestCompSolid.py b/src/BuildPlugin/Test/TestCompSolid.py index f27cb0a8b..63fe29858 100644 --- a/src/BuildPlugin/Test/TestCompSolid.py +++ b/src/BuildPlugin/Test/TestCompSolid.py @@ -45,7 +45,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")]) +Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")]) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_5 = Sketch_2.addLine(20, 0, 0, 0) SketchLine_6 = Sketch_2.addLine(0, 0, 0, 20) @@ -58,7 +58,7 @@ SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False) +SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False) SketchLine_9 = SketchProjection_2.createdFeature() SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_5.startPoint(), SketchLine_9.result()) SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_5.endPoint()) @@ -75,7 +75,7 @@ SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintEqual_3 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_12.result()) model.do() -Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r_wire")]) AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 270, 2) Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")]) Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7f-SketchLine_10f-SketchLine_11f-SketchLine_12f")], model.selection(), 40, 0) @@ -90,17 +90,17 @@ SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_14.endPoint() SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_15.result()) SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_16.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_5s-SketchLine_15s-SketchLine_8e-SketchLine_14e"), False) +SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_5_StartVertex"), False) SketchPoint_2 = SketchProjection_3.createdFeature() SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates()) -SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_11s-SketchLine_10e"), False) +SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_EndVertex"), False) SketchPoint_3 = SketchProjection_4.createdFeature() SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates()) -SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), False) +SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), False) SketchPoint_4 = SketchProjection_5.createdFeature() SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates()) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r")], model.selection(), 20, 0) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection(), 20, 0) Box_1 = model.addBox(Part_1_doc, 20, 20, 20) model.do() @@ -127,12 +127,12 @@ def createCompSolidStepByStep(theSelection, theExpectedType): # ============================================================================= boundaries1 = [model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), - model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"), - model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_2"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_3"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_4"), - model.selection("FACE", "Extrusion_2_1/To_Face_1"), + model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"), + model.selection("FACE", "Extrusion_2_1/To_Face"), model.selection("FACE", "Box_1_1/Front")] expectType1 = [GeomAPI_Shape.SHAPE, GeomAPI_Shape.SHAPE, @@ -153,14 +153,14 @@ model.testHaveNamingSubshapes(CompSolid_1, model, Part_1_doc) # ============================================================================= boundaries2 = [model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), - model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"), - model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), - model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_3"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_4"), - model.selection("FACE", "Extrusion_2_1/To_Face_1"), + model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"), + model.selection("FACE", "Extrusion_2_1/To_Face"), model.selection("FACE", "Box_1_1/Front"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_2"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"), model.selection("SOLID", "Extrusion_1_1")] expectType2 = [GeomAPI_Shape.SHAPE, GeomAPI_Shape.SHAPE, diff --git a/src/BuildPlugin/Test/TestCompound.py b/src/BuildPlugin/Test/TestCompound.py index c55dda70f..58e88e206 100644 --- a/src/BuildPlugin/Test/TestCompound.py +++ b/src/BuildPlugin/Test/TestCompound.py @@ -45,9 +45,9 @@ SketchCircle_1 = Sketch_1.addCircle(51.0302184611028, -58.25492948210744, 14.676 SketchCircle_2 = Sketch_1.addCircle(57.27434431552349, -55.3477547099222, 30.40870102508203) model.do() Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "PartSet/Origin")]) -Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")]) -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2")]) -Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")]) +Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_5")]) +Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_2_2")]) +Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")]) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_6 = Sketch_2.addLine(73.69205241424749, 19.68979803478298, 29.86213888681927, 19.68979803478298) SketchLine_7 = Sketch_2.addLine(29.86213888681927, 19.68979803478298, 29.86213888681927, 46.16063196348271) @@ -62,18 +62,18 @@ SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result()) model.do() -Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r")]) -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), 120, 2) +Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r_wire")]) +AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "Sketch_2/SketchLine_6"), 120, 2) Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")]) Box_1 = model.addBox(Part_1_doc, 10, 10, 10) Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 50) Box_2 = model.addBox(Part_1_doc, 10, 10, 10) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_2_1/Front"), 5, True) Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("FACE", "Plane_1")]) -Compound_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), - model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), - model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"), - model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"), +Compound_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), + model.selection("EDGE", "Sketch_1/SketchLine_1"), + model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire"), + model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"), model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), diff --git a/src/BuildPlugin/Test/TestFace.py b/src/BuildPlugin/Test/TestFace.py index a64a2f913..0dfab8afc 100644 --- a/src/BuildPlugin/Test/TestFace.py +++ b/src/BuildPlugin/Test/TestFace.py @@ -107,7 +107,7 @@ aCylinderShape = aCylinderResult.shape() aSession.startOperation() aFaceFeature2 = aPart.addFeature("Face") aBaseObjectsList = aFaceFeature2.selectionList("base_objects") -aBaseObjectsList.append("Cylinder_1_1/Face_1&Cylinder_1_1/Face_2", "EDGE") +aBaseObjectsList.append("[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]", "EDGE") aSession.finishOperation() assert (len(aFaceFeature2.results()) > 0) diff --git a/src/BuildPlugin/Test/TestInterpolation.py b/src/BuildPlugin/Test/TestInterpolation.py index 656351a48..ddde2e509 100644 --- a/src/BuildPlugin/Test/TestInterpolation.py +++ b/src/BuildPlugin/Test/TestInterpolation.py @@ -45,12 +45,12 @@ SketchLine_2 = Sketch_1.addLine(0, 0, 45, 45) model.do() # Get sketch points -base_name = "Sketch_1/Vertex-SketchPoint_" +base_name = "Sketch_1/SketchPoint_" p_1, p_2, p_3, p_4, p_5 = [model.selection("VERTEX", base_name + str(i + 1)) for i in range(0, 5)] # Get sketch edges -Tangent_1 = model.selection("EDGE", "Sketch_1/Edge-SketchLine_1") -Tangent_2 = model.selection("EDGE", "Sketch_1/Edge-SketchLine_2") +Tangent_1 = model.selection("EDGE", "Sketch_1/SketchLine_1") +Tangent_2 = model.selection("EDGE", "Sketch_1/SketchLine_2") # ============================================================================= # Test 1. Create curve 1-2-3-4-5, closed off, reorder off, without tangents @@ -117,14 +117,14 @@ Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -point_names = ("Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom", - "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top", - "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top", - "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom", - "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom", - "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top", - "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top", - "Box_1_1/Back&Box_1_1/Right&Box_1_1/Bottom") +point_names = ("[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]", + "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]", + "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]", + "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]", + "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]", + "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]", + "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]", + "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]") points = [model.selection("VERTEX", name) for name in point_names] Interpolation_8 = model.addInterpolation(Part_2_doc, points, False, False) @@ -140,8 +140,8 @@ Part_3_doc = Part_3.document() Box_1 = model.addBox(Part_3_doc, 20, 30, 40) points = [model.selection("VERTEX", name) for name in point_names] -Tangent_1 = model.selection("EDGE", "Box_1_1/Back&Box_1_1/Top") -Tangent_2 = model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top") +Tangent_1 = model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]") +Tangent_2 = model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]") Interpolation_9 = model.addInterpolation(Part_3_doc, points, Tangent_1, Tangent_2, False, False) diff --git a/src/BuildPlugin/Test/TestPolyline.py b/src/BuildPlugin/Test/TestPolyline.py index ba399cc54..88da7504a 100644 --- a/src/BuildPlugin/Test/TestPolyline.py +++ b/src/BuildPlugin/Test/TestPolyline.py @@ -42,7 +42,7 @@ SketchPoint_5 = Sketch_1.addPoint(50, 0) model.do() # Get sketch points -base_name = "Sketch_1/Vertex-SketchPoint_" +base_name = "Sketch_1/SketchPoint_" p_1, p_2, p_3, p_4, p_5 = [model.selection("VERTEX", base_name + str(i + 1)) for i in range(0, 5)] # ============================================================================= @@ -100,14 +100,14 @@ Part_2 = model.addPart(partSet) Part_2_doc = Part_2.document() Box_1 = model.addBox(Part_2_doc, 10, 10, 10) -point_names = ("Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom", - "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top", - "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top", - "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom", - "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom", - "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top", - "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top", - "Box_1_1/Back&Box_1_1/Right&Box_1_1/Bottom") +point_names = ("[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]", + "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]", + "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]", + "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]", + "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]", + "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]", + "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]", + "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]") points = [model.selection("VERTEX", name) for name in point_names] Polyline_7 = model.addPolyline3D(Part_2_doc, points, False) @@ -154,4 +154,4 @@ model.end() # ============================================================================= # Test 11. Check Python dump # ============================================================================= -assert(model.checkPythonDump()) \ No newline at end of file +assert(model.checkPythonDump()) diff --git a/src/BuildPlugin/Test/TestSolid.py b/src/BuildPlugin/Test/TestSolid.py index f0be3f0a0..050cf7238 100644 --- a/src/BuildPlugin/Test/TestSolid.py +++ b/src/BuildPlugin/Test/TestSolid.py @@ -45,7 +45,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")]) +Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")]) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) SketchLine_5 = Sketch_2.addLine(20, 0, 0, 0) SketchLine_6 = Sketch_2.addLine(0, 0, 0, 20) @@ -58,7 +58,7 @@ SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result()) SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result()) -SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False) +SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False) SketchLine_9 = SketchProjection_2.createdFeature() SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_5.startPoint(), SketchLine_9.result()) SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_5.endPoint()) @@ -75,7 +75,7 @@ SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result()) SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result()) SketchConstraintEqual_3 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_12.result()) model.do() -Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r_wire")]) AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 270, 2) Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")]) Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7f-SketchLine_10f-SketchLine_11f-SketchLine_12f")], model.selection(), 40, 0) @@ -90,17 +90,17 @@ SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_14.endPoint() SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_15.result()) SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_16.result()) -SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_5s-SketchLine_15s-SketchLine_8e-SketchLine_14e"), False) +SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_5_StartVertex"), False) SketchPoint_2 = SketchProjection_3.createdFeature() SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates()) -SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_11s-SketchLine_10e"), False) +SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_EndVertex"), False) SketchPoint_3 = SketchProjection_4.createdFeature() SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates()) -SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), False) +SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), False) SketchPoint_4 = SketchProjection_5.createdFeature() SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates()) model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r")], model.selection(), 20, 0) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection(), 20, 0) Box_1 = model.addBox(Part_1_doc, 20, 20, 20) model.do() @@ -125,12 +125,12 @@ def createSolidStepByStep(theSelection, theExpected): # ============================================================================= boundaries1 = [model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), - model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"), - model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_2"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_3"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_4"), - model.selection("FACE", "Extrusion_2_1/To_Face_1"), + model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"), + model.selection("FACE", "Extrusion_2_1/To_Face"), model.selection("FACE", "Box_1_1/Front")] expectSolid1 = [False, False, False, False, False, False, False, True, False] Solid_1 = createSolidStepByStep(boundaries1, expectSolid1) @@ -141,12 +141,12 @@ assert(Solid_1 is None) # ============================================================================= boundaries2 = [model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), - model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"), - model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), - model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_3"), - model.selection("FACE", "Extrusion_2_1/Generated_Face_4"), - model.selection("FACE", "Extrusion_2_1/To_Face_1"), + model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), + model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"), + model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"), + model.selection("FACE", "Extrusion_2_1/To_Face"), model.selection("FACE", "Box_1_1/Front")] expectSolid2 = [False, False, False, False, False, False, False, False, True] Solid_2 = createSolidStepByStep(boundaries2, expectSolid2) diff --git a/src/BuildPlugin/Test/TestSubShapes.py b/src/BuildPlugin/Test/TestSubShapes.py index 7fc9813c7..b10358a4c 100644 --- a/src/BuildPlugin/Test/TestSubShapes.py +++ b/src/BuildPlugin/Test/TestSubShapes.py @@ -160,9 +160,9 @@ SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchPoint_1 = Sketch_1.addPoint(-490.566037735849, 50.600343053173) SketchPoint_2 = Sketch_1.addPoint(-423.670668953688, 50.600343053173) model.do() -Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")]) -Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2r")]) -SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Face_1_1"), [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")]) +Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")]) +Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_2_2")]) +SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Face_1_1"), [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")]) SubShapes_1.setBaseShape(model.selection("FACE", "Face_2_1")) model.end() diff --git a/src/BuildPlugin/Test/TestWire.py b/src/BuildPlugin/Test/TestWire.py index 25dd4ecb2..5b9fdfc54 100644 --- a/src/BuildPlugin/Test/TestWire.py +++ b/src/BuildPlugin/Test/TestWire.py @@ -111,7 +111,7 @@ SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) model.do() -Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")]) +Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")]) Wire_1.addContour() model.end() @@ -134,12 +134,12 @@ aBoxShape = aBoxResult.shape() aSession.startOperation() aWireFeature2 = aPart.addFeature("Wire") aBaseObjectsList = aWireFeature2.selectionList("base_objects") -aBaseObjectsList.append("Box_1_1/Front&Box_1_1/Bottom", "EDGE") -aBaseObjectsList.append("Box_1_1/Front&Box_1_1/Right", "EDGE") -aBaseObjectsList.append("Box_1_1/Right&Box_1_1/Top", "EDGE") -aBaseObjectsList.append("Box_1_1/Back&Box_1_1/Top", "EDGE") -aBaseObjectsList.append("Box_1_1/Back&Box_1_1/Left", "EDGE") -aBaseObjectsList.append("Box_1_1/Left&Box_1_1/Bottom", "EDGE") +aBaseObjectsList.append("[Box_1_1/Front][Box_1_1/Bottom]", "EDGE") +aBaseObjectsList.append("[Box_1_1/Front][Box_1_1/Right]", "EDGE") +aBaseObjectsList.append("[Box_1_1/Right][Box_1_1/Top]", "EDGE") +aBaseObjectsList.append("[Box_1_1/Back][Box_1_1/Top]", "EDGE") +aBaseObjectsList.append("[Box_1_1/Back][Box_1_1/Left]", "EDGE") +aBaseObjectsList.append("[Box_1_1/Left][Box_1_1/Bottom]", "EDGE") aSession.finishOperation() # Test results -- 2.39.2