From: azv Date: Fri, 15 Dec 2017 15:23:18 +0000 (+0300) Subject: Adjust unit tests for Boolean Fill X-Git-Tag: V_2.10.0RC~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f94de332b8a255060416f0c5330c7894a34b83d;p=modules%2Fshaper.git Adjust unit tests for Boolean Fill --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index 27f039918..64072e62a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -731,16 +731,12 @@ void FeaturesPlugin_Boolean::loadNamingDS(std::shared_ptr t std::string aName; for(ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) { - if((*anIter)->shapeType() == GeomAPI_Shape::EDGE) { - aTag = aModifyEdgeTag; - aName = aModEName; - } - else if((*anIter)->shapeType() == GeomAPI_Shape::FACE) { + if((*anIter)->shapeType() <= GeomAPI_Shape::FACE) { aTag = aModifyFaceTag; aName = aModFName; } else { - aTag = aModifyFaceTag; - aName = aModFName; + aTag = aModifyEdgeTag; + aName = aModEName; } theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, aName == aModEName ? GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE, diff --git a/src/FeaturesPlugin/Test/TestFillFaceWire.py b/src/FeaturesPlugin/Test/TestFillFaceWire.py index a9eca062a..a796ddacf 100644 --- a/src/FeaturesPlugin/Test/TestFillFaceWire.py +++ b/src/FeaturesPlugin/Test/TestFillFaceWire.py @@ -39,30 +39,24 @@ SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint() SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_2.result()) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R") model.do() -Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) -SketchLine_4 = Sketch_2.addLine(29.74624907439609, 30.07487215963349, 31.08202242513997, 0) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1"), False) -SketchPoint_1 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchPoint_1.result()) -SketchLine_5 = Sketch_2.addLine(31.08202242513997, 0, 45.45797599933665, 0) -SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) -SketchLine_6 = SketchProjection_3.createdFeature() -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) -SketchLine_7 = Sketch_2.addLine(45.45797599933665, 0, 45.83553599350717, -22.747645239555) -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) -SketchLine_8 = Sketch_2.addLine(45.83553599350717, -22.747645239555, 70.40999925541598, 30.039147749218) -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) -SketchLine_9 = Sketch_2.addLine(70.40999925541598, 30.039147749218, 29.74624907439609, 30.07487215963349) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.endPoint()) +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_4 = Sketch_2.addLine(-42.38833891077762, 73.71572760627062, -18.23994072168525, 7.835320880296757) +SketchLine_5 = Sketch_2.addLine(-18.23994072168525, 7.835320880296757, 13.89341696052619, 27.33089138697832) +SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_6 = Sketch_2.addLine(13.89341696052619, 27.33089138697832, 39.39985877388298, 9.747860956493145) +SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchLine_7 = Sketch_2.addLine(39.39985877388298, 9.747860956493145, 38.20105433548567, 71.93732104572752) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint()) +SketchLine_8 = Sketch_2.addLine(38.20105433548567, 71.93732104572752, -42.38833891077762, 73.71572760627062) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_8.endPoint()) model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")]) -Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchLine_8f-SketchLine_9f")]) +Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")]) Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("WIRE", "Wire_1_1")]) model.do() -model.checkBooleansResult(Boolean_1, model, 1, [0], [0], [1], [4], [9]) +model.checkBooleansResult(Boolean_1, model, 1, [5], [0], [5], [21], [42]) model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc) model.end() diff --git a/src/FeaturesPlugin/Test/TestFillShellFace.py b/src/FeaturesPlugin/Test/TestFillShellFace.py index e791e6f53..1ece54f1a 100644 --- a/src/FeaturesPlugin/Test/TestFillShellFace.py +++ b/src/FeaturesPlugin/Test/TestFillShellFace.py @@ -61,50 +61,44 @@ SketchLine_7.result().setName("SketchLine_8") SketchLine_7.setAuxiliary(True) SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_7.result()) SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.result(), "D", True) -SketchLine_8 = Sketch_2.addLine(57.5, 0, 80, -10.81485284151855) +SketchLine_8 = Sketch_2.addLine(50, -3.170182618622045, 80, -14.17077918941143) SketchLine_8.setName("SketchLine_9") SketchLine_8.result().setName("SketchLine_9") -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) -SketchLine_9 = SketchProjection_3.createdFeature() -SketchLine_9.setName("SketchLine_10") -SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(80, -10.81485284151855, 65, 11.50710132369052) -SketchLine_10.setName("SketchLine_11") -SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) -SketchLine_11 = Sketch_2.addLine(65, 11.50710132369052, 50, 11.50710132369052) -SketchLine_11.setName("SketchLine_12") -SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_8.startPoint(), SketchLine_7.result(), "L/4", True) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_8.endPoint(), SketchLine_7.result(), "L", True) -SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_10.endPoint(), SketchLine_7.result(), "L/2", True) -SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_11.result()) -SketchConstraintMirror_1_objects = [SketchLine_8.result(), SketchLine_10.result(), SketchLine_11.result()] +SketchLine_9 = Sketch_2.addLine(80, -14.17077918941143, 64.99999999999999, 12.18920647716607) +SketchLine_9.setName("SketchLine_11") +SketchLine_9.result().setName("SketchLine_11") +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9") +SketchLine_10 = Sketch_2.addLine(64.99999999999999, 12.18920647716607, 50, 12.18920647716607) +SketchLine_10.setName("SketchLine_12") +SketchLine_10.result().setName("SketchLine_12") +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_7.result()) +SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_8.endPoint(), SketchLine_7.result(), "L", True) +SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_9.endPoint(), SketchLine_7.result(), "L/2", True) +SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_10.result()) +SketchConstraintMirror_1_objects = [SketchLine_8.result(), SketchLine_9.result(), SketchLine_10.result()] SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_7.result(), SketchConstraintMirror_1_objects) -[SketchLine_12, SketchLine_13, SketchLine_14] = SketchConstraintMirror_1.mirrored() -SketchLine_14.setName("SketchLine_15") -SketchLine_14.result().setName("SketchLine_15") -SketchLine_13.setName("SketchLine_14") -SketchLine_13.result().setName("SketchLine_14") -SketchLine_12.setName("SketchLine_13") -SketchLine_12.result().setName("SketchLine_13") -SketchLine_15 = Sketch_2.addLine(42.5, 0, 57.5, 0) -SketchLine_15.setName("SketchLine_16") -SketchLine_15.result().setName("SketchLine_16") -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_8.startPoint()) +[SketchLine_11, SketchLine_12, SketchLine_13] = SketchConstraintMirror_1.mirrored() +SketchLine_13.setName("SketchLine_15") +SketchLine_13.result().setName("SketchLine_15") +SketchLine_12.setName("SketchLine_14") +SketchLine_12.result().setName("SketchLine_14") +SketchLine_11.setName("SketchLine_13") +SketchLine_11.result().setName("SketchLine_13") +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"), False) +SketchPoint_2 = SketchProjection_3.createdFeature() +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_7.result()) model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")]) Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")]) Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")]) -Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16f")]) +Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r")]) Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "Face_3_1")]) model.do() -model.checkBooleansResult(Boolean_1, model, 1, [0], [0], [4], [17], [34]) +model.checkBooleansResult(Boolean_1, model, 1, [0], [0], [4], [13], [26]) model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc) model.end() diff --git a/src/FeaturesPlugin/Test/TestFillShellWire.py b/src/FeaturesPlugin/Test/TestFillShellWire.py index d7d5ea097..017eb7ee7 100644 --- a/src/FeaturesPlugin/Test/TestFillShellWire.py +++ b/src/FeaturesPlugin/Test/TestFillShellWire.py @@ -52,59 +52,33 @@ SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4. SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_5.result()) SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_3.result()) model.do() -Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) +Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_7 = Sketch_2.addLine(-14.33356820392057, 60, 15.66643179607943, 60) +SketchLine_8 = Sketch_2.addLine(15.66643179607943, 60, 15.66643179607943, 30) +SketchLine_9 = Sketch_2.addLine(15.66643179607943, 30, -14.33356820392057, 30) +SketchLine_10 = Sketch_2.addLine(-14.33356820392057, 30, -14.33356820392057, 60) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_8.result()) +SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_9.result()) +SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_10.result()) +SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_9.result(), "L") +SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_8.result(), "L") SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) SketchPoint_1 = SketchProjection_2.createdFeature() -SketchLine_7 = Sketch_2.addLine(50, -39.61510263929618, 50, 43.87280058651025) -SketchLine_7.setName("SketchLine_8") -SketchLine_7.result().setName("SketchLine_8") -SketchLine_7.setAuxiliary(True) -SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_7.result()) -SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_7.result(), "D", True) -SketchLine_8 = Sketch_2.addLine(57.5, 0, 65, -10.81485284151855) -SketchLine_8.setName("SketchLine_9") -SketchLine_8.result().setName("SketchLine_9") -SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) -SketchLine_9 = SketchProjection_3.createdFeature() -SketchLine_9.setName("SketchLine_10") -SketchLine_9.result().setName("SketchLine_10") -SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_9.result()) -SketchLine_10 = Sketch_2.addLine(65, -10.81485284151855, 65, 11.50710132369052) -SketchLine_10.setName("SketchLine_11") -SketchLine_10.result().setName("SketchLine_11") -SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_10.startPoint()) -SketchLine_11 = Sketch_2.addLine(65, 11.50710132369052, 50, 11.50710132369052) -SketchLine_11.setName("SketchLine_12") -SketchLine_11.result().setName("SketchLine_12") -SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result()) -SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_8.startPoint(), SketchLine_7.result(), "L/4", True) -SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_8.endPoint(), SketchLine_7.result(), "L/2", True) -SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_10.endPoint(), SketchLine_7.result(), "L/2", True) -SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_11.result()) -SketchConstraintMirror_1_objects = [SketchLine_8.result(), SketchLine_10.result(), SketchLine_11.result()] -SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_7.result(), SketchConstraintMirror_1_objects) -[SketchLine_12, SketchLine_13, SketchLine_14] = SketchConstraintMirror_1.mirrored() -SketchLine_14.setName("SketchLine_15") -SketchLine_14.result().setName("SketchLine_15") -SketchLine_13.setName("SketchLine_14") -SketchLine_13.result().setName("SketchLine_14") -SketchLine_12.setName("SketchLine_13") -SketchLine_12.result().setName("SketchLine_13") -SketchLine_15 = Sketch_2.addLine(42.5, 0, 57.5, 0) -SketchLine_15.setName("SketchLine_16") -SketchLine_15.result().setName("SketchLine_16") -SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint()) -SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_8.startPoint()) +SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.result(), "L", True) model.do() Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")]) Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")]) Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")]) -Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16f")]) +Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_10")]) Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("WIRE", "Wire_1_1")]) model.do() -model.checkBooleansResult(Boolean_1, model, 1, [0], [0], [2], [10], [22]) +model.checkBooleansResult(Boolean_1, model, 1, [0], [0], [8], [30], [60]) model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc) model.end()