From: Artem Zhidkov Date: Mon, 12 Oct 2020 09:18:29 +0000 (+0300) Subject: Issue #20167: checkPythonDump() errors X-Git-Tag: V9_6_0b1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3e651ceffa98fe8830492b91c533666719519389;p=modules%2Fshaper.git Issue #20167: checkPythonDump() errors Revert the copying base shapes of prism (produced by the previous commit). Use optimal bounding box on dump instead. --- diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 7523412b9..c93c66a17 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -683,4 +683,5 @@ ADD_UNIT_TESTS(TestExtrusion.py TestFillet1D_Wire_4.py TestFillet1D_Wire_5.py Test19931.py + Test20027.py ) diff --git a/src/FeaturesPlugin/Test/Test20027.py b/src/FeaturesPlugin/Test/Test20027.py new file mode 100644 index 000000000..21d21c301 --- /dev/null +++ b/src/FeaturesPlugin/Test/Test20027.py @@ -0,0 +1,285 @@ +# Copyright (C) 2020 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 +# + +from SketchAPI import * + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(0, 0, 0, -99) +SketchLine_1.setAuxiliary(True) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) +SketchLine_2 = Sketch_1.addLine(0, 0, -44, 0) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) +SketchLine_3 = Sketch_1.addLine(-44, 0, -44, -57.48528137423859) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 44) +SketchArc_1 = Sketch_1.addArc(-31, -57.48528137423859, -44, -57.48528137423859, -40.19238815542511, -66.6776695296637, False) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint()) +SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1]) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 13) +SketchLine_4 = Sketch_1.addLine(-40.19238815542511, -66.6776695296637, -13.4350288425444, -93.43502884254441) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint()) +SketchArc_2 = Sketch_1.addArc(0, -80, -13.4350288425444, -93.43502884254441, 0, -99, False) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_2.center()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_2.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_2.endPoint()) +SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result()) +SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_2.results()[1]) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_2.endPoint()) +SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 19) +SketchLine_5 = Sketch_1.addLine(0, -80, -13.4350288425444, -93.43502884254441) +SketchLine_5.setName("SketchLine_6") +SketchLine_5.result().setName("SketchLine_6") +SketchLine_5.setAuxiliary(True) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_5.startPoint()) +SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_12") +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.endPoint()) +SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13") +SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_5.result(), SketchLine_1.result(), 45, type = "Supplementary") +SketchConstraintMirror_1_objects = [SketchLine_2.result(), SketchLine_3.result(), SketchArc_1.results()[1], SketchLine_4.result(), SketchArc_2.results()[1]] +SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), SketchConstraintMirror_1_objects) +[SketchLine_6, SketchLine_7, SketchArc_3, SketchLine_8, SketchArc_4] = SketchConstraintMirror_1.mirrored() +SketchLine_8.setName("SketchLine_9") +SketchLine_8.result().setName("SketchLine_9") +SketchLine_7.setName("SketchLine_8") +SketchLine_7.result().setName("SketchLine_8") +SketchLine_6.setName("SketchLine_7") +SketchLine_6.result().setName("SketchLine_7") +SketchCircle_1 = Sketch_1.addCircle(-25, -44, 5) +SketchCircle_1.setName("SketchCircle_2") +SketchCircle_1.result().setName("SketchCircle_2") +SketchCircle_1.results()[1].setName("SketchCircle_2_2") +SketchCircle_2 = Sketch_1.addCircle(25, -44, 5) +SketchCircle_2.setName("SketchCircle_3") +SketchCircle_2.result().setName("SketchCircle_3") +SketchCircle_2.results()[1].setName("SketchCircle_3_2") +SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1]) +SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5) +SketchConstraintRadius_3.setName("SketchConstraintRadius_7") +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchCircle_2.center(), 50, True) +SketchConstraintDistance_1.setName("SketchConstraintDistance_4") +SketchLine_9 = Sketch_1.addLine(-25, -44, 25, -44) +SketchLine_9.setName("SketchLine_21") +SketchLine_9.result().setName("SketchLine_21") +SketchLine_9.setAuxiliary(True) +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_28") +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_9.endPoint()) +SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_29") +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result()) +SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_4") +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Arc(SketchArc_4).center(), SketchLine_9.result(), 36, True) +SketchConstraintDistance_2.setName("SketchConstraintDistance_5") +SketchPoint_2 = Sketch_1.addPoint(2.896598636358403e-31, -44) +SketchPoint_2.setName("SketchPoint_4") +SketchPoint_2.result().setName("SketchPoint_4") +SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) +SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_30") +SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_9.result(), SketchPoint_2.coordinates()) +SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_31") +SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_6.result(), SketchLine_5.startPoint(), 80, True) +SketchConstraintDistance_3.setName("SketchConstraintDistance_8") +model.do() +Sketch_1.changeFacesOrder([[SketchLine_2.result(), SketchLine_3.result(), SketchArc_1.results()[1], SketchLine_4.result(), SketchArc_2.results()[1], SketchArc_4.results()[1], SketchLine_8.result(), SketchArc_3.results()[1], SketchLine_7.result(), SketchLine_6.result(), SketchCircle_1.results()[1], SketchCircle_2.results()[1]], + [SketchCircle_2.results()[1]], + [SketchCircle_1.results()[1]] + ]) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchArc_1_2f-SketchLine_4f-SketchArc_2_2f-SketchArc_4_2f-SketchLine_9r-SketchArc_3_2f-SketchLine_8r-SketchLine_7r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 10, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) +SketchLine_10 = Sketch_2.addLine(0, 0, 0, -16) +SketchLine_10.setName("SketchLine_10") +SketchLine_10.result().setName("SketchLine_10") +SketchLine_10.setAuxiliary(True) +SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"), False) +SketchPoint_3 = SketchProjection_2.createdFeature() +SketchPoint_3.setName("SketchPoint_2") +SketchPoint_3.result().setName("SketchPoint_2") +SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchPoint_3.result()) +SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_14") +SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_10.result()) +SketchLine_11 = Sketch_2.addLine(-44, 0, -44, -13) +SketchLine_11.setName("SketchLine_11") +SketchLine_11.result().setName("SketchLine_11") +SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False) +SketchPoint_4 = SketchProjection_3.createdFeature() +SketchPoint_4.setName("SketchPoint_3") +SketchPoint_4.result().setName("SketchPoint_3") +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchPoint_4.result()) +SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_15") +SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_11.result()) +SketchLine_12 = Sketch_2.addLine(-44, -13, -21.99999999999997, -13) +SketchLine_12.setName("SketchLine_12") +SketchLine_12.result().setName("SketchLine_12") +SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint()) +SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_16") +SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_12.result()) +SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_2") +SketchArc_5 = Sketch_2.addArc(-22, -16.00000000000039, -21.99999999999997, -13, -19, -16, True) +SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchArc_5.startPoint()) +SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_17") +SketchConstraintTangent_4 = Sketch_2.setTangent(SketchLine_12.result(), SketchArc_5.results()[1]) +SketchLine_13 = Sketch_2.addLine(-19, -16, 0, -16) +SketchLine_13.setName("SketchLine_13") +SketchLine_13.result().setName("SketchLine_13") +SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_13.startPoint()) +SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_18") +SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_19") +SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_13.result()) +SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_3") +SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_5.results()[1], 3) +SketchConstraintRadius_4.setName("SketchConstraintRadius_3") +SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_13.result(), "38/2") +SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_13.result(), SketchLine_12.endPoint(), 3, True) +SketchConstraintDistance_4.setName("SketchConstraintDistance_2") +SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_11.result(), 13) +SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_10.endPoint()) +SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_20") +SketchLine_14 = Sketch_2.addLine(-44, 0, -25, 0) +SketchLine_14.setName("SketchLine_14") +SketchLine_14.result().setName("SketchLine_14") +SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_14.startPoint()) +SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_21") +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) +SketchLine_15 = SketchProjection_4.createdFeature() +SketchLine_15.setName("SketchLine_15") +SketchLine_15.result().setName("SketchLine_15") +SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.result()) +SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_22") +SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_16 = SketchProjection_5.createdFeature() +SketchLine_16.setName("SketchLine_16") +SketchLine_16.result().setName("SketchLine_16") +SketchArc_6 = Sketch_2.addArc(-25, 6, -25, 0, -19, 6, False) +SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchArc_6.startPoint()) +SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_23") +SketchConstraintTangent_5 = Sketch_2.setTangent(SketchLine_14.result(), SketchArc_6.results()[1]) +SketchArc_7 = Sketch_2.addArc(0, 5.999999999999997, -19, 6, 0, 25, True) +SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchArc_7.startPoint()) +SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_24") +SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchArc_7.results()[1]) +SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchArc_7.endPoint(), SketchLine_16.result()) +SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_25") +SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_7.center(), SketchLine_16.result()) +SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_26") +SketchConstraintRadius_5 = Sketch_2.setRadius(SketchArc_7.results()[1], 19) +SketchConstraintRadius_5.setName("SketchConstraintRadius_4") +SketchConstraintRadius_6 = Sketch_2.setRadius(SketchArc_6.results()[1], 6) +SketchConstraintRadius_6.setName("SketchConstraintRadius_5") +SketchConstraintDistance_5 = Sketch_2.setDistance(SketchArc_7.center(), SketchLine_12.result(), 19, True) +SketchConstraintDistance_5.setName("SketchConstraintDistance_3") +SketchConstraintMirror_2_objects = [SketchArc_5.results()[1], SketchLine_12.result(), SketchLine_11.result(), SketchArc_6.results()[1], SketchArc_7.results()[1], SketchLine_13.result(), SketchLine_14.result()] +SketchConstraintMirror_2 = Sketch_2.addMirror(SketchLine_10.result(), SketchConstraintMirror_2_objects) +[SketchArc_8, SketchLine_17, SketchLine_18, SketchArc_9, SketchArc_10, SketchLine_19, SketchLine_20] = SketchConstraintMirror_2.mirrored() +SketchLine_20.setName("SketchLine_20") +SketchLine_20.result().setName("SketchLine_20") +SketchLine_19.setName("SketchLine_19") +SketchLine_19.result().setName("SketchLine_19") +SketchLine_18.setName("SketchLine_18") +SketchLine_18.result().setName("SketchLine_18") +SketchLine_17.setName("SketchLine_17") +SketchLine_17.result().setName("SketchLine_17") +SketchCircle_3 = Sketch_2.addCircle(0, 5.999999999999997, 9.5) +SketchCircle_3.setName("SketchCircle_1") +SketchCircle_3.result().setName("SketchCircle_1") +SketchCircle_3.results()[1].setName("SketchCircle_1_2") +SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_7.center(), SketchCircle_3.center()) +SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_27") +SketchConstraintRadius_7 = Sketch_2.setRadius(SketchCircle_3.results()[1], "19/2") +SketchConstraintRadius_7.setName("SketchConstraintRadius_6") +model.do() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchArc_5_2r-SketchLine_13f-SketchLine_19r-SketchArc_8_2r-SketchLine_17r-SketchLine_18r-SketchLine_20f-SketchArc_9_2r-SketchArc_10_2f-SketchArc_7_2f-SketchArc_6_2r-SketchLine_14r-SketchCircle_1_2r")], model.selection(), 40, 10) +Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) +SketchLine_21 = Sketch_3.addLine(-16, 50, -20, 50) +SketchLine_21.setName("SketchLine_22") +SketchLine_21.result().setName("SketchLine_22") +SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_13][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19][Extrusion_2_1/To_Face]"), False) +SketchPoint_5 = SketchProjection_6.createdFeature() +SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchPoint_5.result()) +SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_32") +SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_21.result()) +SketchLine_22 = Sketch_3.addLine(-20, 50, -80, 10) +SketchLine_22.setName("SketchLine_23") +SketchLine_22.result().setName("SketchLine_23") +SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint()) +SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_33") +SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_5_2][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_13]"), True) +SketchLine_23 = SketchProjection_7.createdFeature() +SketchLine_23.setName("SketchLine_24") +SketchLine_23.result().setName("SketchLine_24") +SketchLine_24 = Sketch_3.addLine(-16, 9.999999999999996, -80, 10) +SketchLine_24.setName("SketchLine_25") +SketchLine_24.result().setName("SketchLine_25") +SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_24.startPoint(), SketchLine_23.result()) +SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_34") +SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_24.result()) +SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.endPoint()) +SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_35") +SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_25 = SketchProjection_8.createdFeature() +SketchLine_25.setName("SketchLine_26") +SketchLine_25.result().setName("SketchLine_26") +SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_22.startPoint(), SketchLine_25.result(), 20, True) +SketchConstraintDistance_6.setName("SketchConstraintDistance_6") +SketchConstraintDistance_7 = Sketch_3.setDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_24.startPoint(), 40, True) +SketchConstraintDistance_7.setName("SketchConstraintDistance_7") +SketchConstraintLength_4 = Sketch_3.setLength(SketchLine_24.result(), "67-3") +model.do() +Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_22r-SketchLine_23f-SketchLine_25r-SketchProjection_7f")], model.selection(), 5, 5) +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), [model.selection("SOLID", "Extrusion_1_1")]) +Fuse_1_objects_1 = [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_1_1"), model.selection("SOLID", "Extrusion_3_1")] +Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1, removeEdges = True, keepSubResults = True) +model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc) +model.end() + +from GeomAPI import GeomAPI_Shape +model.testNbResults(Fuse_1, 1) +model.testNbSubResults(Fuse_1, [0]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [27]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [150]) +model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [300]) +model.testResultsVolumes(Fuse_1, [162690.939657109178369864821434021]) + +from ModelAPI import * +aFactory = ModelAPI_Session.get().validators() + +# Check that the features are not in error +for i in range(Part_1_doc.size("Features")): + feature = objectToFeature(Part_1_doc.object("Features", i)) + name = feature.name() + error = feature.error() + assert(error == ''), "The feature {0} is in error: {1}".format(name, error) + assert(aFactory.validate(feature)), "The feature {0} is in error: {1}".format(name, error) + +assert(Part_1_doc.size("Groups") == 3) + +assert(model.checkPythonDump()) diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index 4ddbe474e..ea59ae09b 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -593,7 +593,7 @@ bool GeomAPI_Shape::computeSize(double& theXmin, double& theYmin, double& theZmi if (aShape.IsNull()) return false; Bnd_Box aBndBox; - BRepBndLib::Add(aShape, aBndBox, false); + BRepBndLib::AddOptimal(aShape, aBndBox, false, true); if (aBndBox.IsVoid()) return false; aBndBox.Get(theXmin, theYmin, theZmin, theXmax, theYmax, theZmax); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp index 3cee6ce0e..50b2ef2b1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp @@ -299,7 +299,7 @@ void GeomAlgoAPI_Prism::buildBySizes(const GeomShapePtr theBaseShape // Making prism. BRepPrimAPI_MakePrism* aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * (theFromSize + theToSize), true); + new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * (theFromSize + theToSize)); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; } @@ -407,7 +407,7 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap // Making prism. BRepPrimAPI_MakePrism* aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength, true); + new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); if(!aPrismBuilder || !aPrismBuilder->IsDone()) { return; } @@ -457,7 +457,7 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap // Solid based on "To" bounding plane gp_Vec aNormal = aToDir->impl(); BRepPrimAPI_MakePrism* aToPrismBuilder = - new BRepPrimAPI_MakePrism(aToShape, aNormal * (-2.0 * aBndBoxSize), true); + new BRepPrimAPI_MakePrism(aToShape, aNormal * (-2.0 * aBndBoxSize)); if (!aToPrismBuilder || !aToPrismBuilder->IsDone()) { return; } @@ -494,7 +494,7 @@ void GeomAlgoAPI_Prism::buildByPlanes(const GeomShapePtr theBaseShap // Solid based on "From" bounding plane aNormal = aFromDir->impl(); BRepPrimAPI_MakePrism* aFromPrismBuilder = - new BRepPrimAPI_MakePrism(aFromShape, aNormal * (-2.0 * aBndBoxSize), true); + new BRepPrimAPI_MakePrism(aFromShape, aNormal * (-2.0 * aBndBoxSize)); if (!aFromPrismBuilder || !aFromPrismBuilder->IsDone()) { return; } @@ -595,7 +595,7 @@ void GeomAlgoAPI_Prism::buildByFaces(const GeomShapePtr theBaseShape // Making prism. BRepPrimAPI_MakePrism* aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength, true); + new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; } diff --git a/src/ModelHighAPI/CMakeLists.txt b/src/ModelHighAPI/CMakeLists.txt index 982450580..e52c3807d 100644 --- a/src/ModelHighAPI/CMakeLists.txt +++ b/src/ModelHighAPI/CMakeLists.txt @@ -128,4 +128,5 @@ ADD_UNIT_TESTS( Test19031.py Test19990_1.py Test19990_2.py + Test20167.py ) diff --git a/src/ModelHighAPI/Test/Test20167.py b/src/ModelHighAPI/Test/Test20167.py new file mode 100644 index 000000000..7223a0b5b --- /dev/null +++ b/src/ModelHighAPI/Test/Test20167.py @@ -0,0 +1,421 @@ +# Copyright (C) 2020 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 +# + +from SketchAPI import * + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +model.addParameter(Part_1_doc, "h1", "15") +model.addParameter(Part_1_doc, "h2", "70") +model.addParameter(Part_1_doc, "h3", "7") +model.addParameter(Part_1_doc, "d", "15") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchLine_1 = Sketch_1.addLine(-7.500000000000083, -15.81138830084192, -7.500000000000083, -26.99999999999995) +SketchLine_1.setName("SketchLine_2") +SketchLine_1.result().setName("SketchLine_2") +SketchLine_2 = Sketch_1.addLine(-4.499999999999853, -30, 4.499999999999912, -30) +SketchLine_2.setName("SketchLine_3") +SketchLine_2.result().setName("SketchLine_3") +SketchLine_3 = Sketch_1.addLine(7.499999999999912, -27, 7.499999999999912, -15.81138830084196) +SketchLine_3.setName("SketchLine_4") +SketchLine_3.result().setName("SketchLine_4") +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) +SketchConstraintHorizontal_1.setName("SketchConstraintHorizontal_2") +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result()) +SketchPoint_2 = Sketch_1.addPoint(0, -30) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_6") +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_4 = SketchProjection_2.createdFeature() +SketchLine_4.setName("SketchLine_5") +SketchLine_4.result().setName("SketchLine_5") +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_4.result()) +SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_7") +SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_5 = SketchProjection_3.createdFeature() +SketchLine_5.setName("SketchLine_6") +SketchLine_5.result().setName("SketchLine_6") +SketchArc_1 = Sketch_1.addArc(0, 0, -7.500000000000083, -15.81138830084192, -17.44306393762917, 1.410503622037771, True) +SketchArc_1.setName("SketchArc_2") +SketchArc_1.result().setName("SketchArc_2") +SketchArc_1.results()[1].setName("SketchArc_2_2") +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center()) +SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_3") +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 17.5) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.startPoint()) +SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_14") +SketchArc_2 = Sketch_1.addArc(-4.499999999999853, -27, -7.500000000000083, -26.99999999999995, -4.499999999999853, -30, False) +SketchArc_2.setName("SketchArc_3") +SketchArc_2.result().setName("SketchArc_3") +SketchArc_2.results()[1].setName("SketchArc_3_2") +SketchPoint_3 = Sketch_1.addPoint(-7.500000000000085, -30) +SketchPoint_3.setAuxiliary(True) +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchLine_5.result(), 30, True) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8") +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_1.result()) +SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9") +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_1.endPoint()) +SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10") +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint()) +SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11") +SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result()) +SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result()) +SketchArc_3 = Sketch_1.addArc(4.499999999999912, -27, 4.499999999999912, -30, 7.499999999999912, -27, False) +SketchArc_3.setName("SketchArc_4") +SketchArc_3.result().setName("SketchArc_4") +SketchArc_3.results()[1].setName("SketchArc_4_2") +SketchPoint_4 = Sketch_1.addPoint(7.499999999999914, -30) +SketchPoint_4.setAuxiliary(True) +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchPoint_3.coordinates(), SketchPoint_4.coordinates(), 15, False) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_3.result()) +SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_13") +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_2.result()) +SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_15") +SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_2.endPoint()) +SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_16") +SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_3.startPoint()) +SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_17") +SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) +SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_2.result()) +SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 3) +SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_2.results()[1]) +SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result()) +SketchMultiRotation_1_objects = [SketchLine_1.result(), SketchArc_2.results()[1], SketchLine_2.result(), SketchArc_3.results()[1], SketchLine_3.result()] +SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_5).startPoint(), 360, 3, True) +[SketchLine_6, SketchLine_7, SketchArc_4, SketchArc_5, SketchLine_8, SketchLine_9, SketchArc_6, SketchArc_7, SketchLine_10, SketchLine_11] = SketchMultiRotation_1.rotated() +SketchLine_11.setName("SketchLine_14") +SketchLine_11.result().setName("SketchLine_14") +SketchLine_10.setName("SketchLine_13") +SketchLine_10.result().setName("SketchLine_13") +SketchArc_7.setName("SketchArc_9") +SketchArc_7.result().setName("SketchArc_9") +SketchArc_7.results()[1].setName("SketchArc_9_2") +SketchArc_6.setName("SketchArc_8") +SketchArc_6.result().setName("SketchArc_8") +SketchArc_6.results()[1].setName("SketchArc_8_2") +SketchLine_9.setName("SketchLine_11") +SketchLine_9.result().setName("SketchLine_11") +SketchLine_8.setName("SketchLine_10") +SketchLine_8.result().setName("SketchLine_10") +SketchArc_5.setName("SketchArc_6") +SketchArc_5.result().setName("SketchArc_6") +SketchArc_5.results()[1].setName("SketchArc_6_2") +SketchArc_4.setName("SketchArc_5") +SketchArc_4.result().setName("SketchArc_5") +SketchArc_4.results()[1].setName("SketchArc_5_2") +SketchLine_7.setName("SketchLine_8") +SketchLine_7.result().setName("SketchLine_8") +SketchLine_6.setName("SketchLine_7") +SketchLine_6.result().setName("SketchLine_7") +SketchArc_8 = Sketch_1.addArc(0, 0, -9.943063937629109, 14.40088467880429, 9.94306393762926, 14.40088467880419, True) +SketchArc_8.setName("SketchArc_10") +SketchArc_8.result().setName("SketchArc_10") +SketchArc_8.results()[1].setName("SketchArc_10_2") +SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_8.results()[1]) +SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_8.center()) +SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_18") +SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_11.result()) +SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19") +SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_8.startPoint(), SketchLine_7.result()) +SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20") +SketchArc_9 = Sketch_1.addArc(0, 0, 17.44306393762918, 1.410503622037589, 7.499999999999912, -15.81138830084196, True) +SketchArc_9.setName("SketchArc_11") +SketchArc_9.result().setName("SketchArc_11") +SketchArc_9.results()[1].setName("SketchArc_11_2") +SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchLine_3.endPoint()) +SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_12") +SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_8.results()[1], SketchArc_9.results()[1]) +SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_8.center(), SketchArc_9.center()) +SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_21") +SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_10.result()) +SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22") +SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchLine_6.result()) +SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23") +SketchCircle_1 = Sketch_1.addCircle(0, 0, 24) +SketchCircle_1.setAuxiliary(True) +SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center()) +SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24") +SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], 24) +SketchCircle_2 = Sketch_1.addCircle(0, -24, 4) +SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center()) +SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25") +SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], 4) +SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_4.result()) +SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26") +SketchMultiRotation_2 = Sketch_1.addRotation([SketchCircle_2.results()[1]], SketchAPI_Line(SketchLine_4).startPoint(), 360, 3, True) +[SketchCircle_3, SketchCircle_4] = SketchMultiRotation_2.rotated() +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r")], model.selection(), "h1", 0) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face")) +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_12 = SketchProjection_4.createdFeature() +SketchLine_12.setName("SketchLine_12") +SketchLine_12.result().setName("SketchLine_12") +SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_13 = SketchProjection_5.createdFeature() +SketchLine_13.setName("SketchLine_15") +SketchLine_13.result().setName("SketchLine_15") +SketchLine_14 = Sketch_2.addLine(7.500000000000332, 12.99038105676728, 15, 0) +SketchLine_14.setName("SketchLine_16") +SketchLine_14.result().setName("SketchLine_16") +SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_12.result()) +SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28") +SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.startPoint(), "d", True) +SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_14.endPoint(), "d", True) +SketchLine_15 = Sketch_2.addLine(0, 0, 7.500000000000332, 12.99038105676728) +SketchLine_15.setName("SketchLine_17") +SketchLine_15.result().setName("SketchLine_17") +SketchLine_15.setAuxiliary(True) +SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint()) +SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_27") +SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchLine_15.endPoint()) +SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29") +SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_12.result(), SketchLine_15.result(), "360/6") +SketchMultiRotation_3 = Sketch_2.addRotation([SketchLine_14.result()], SketchAPI_Line(SketchLine_12).startPoint(), 360, 6, True) +[SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_20] = SketchMultiRotation_3.rotated() +SketchLine_20.setName("SketchLine_22") +SketchLine_20.result().setName("SketchLine_22") +SketchLine_19.setName("SketchLine_21") +SketchLine_19.result().setName("SketchLine_21") +SketchLine_18.setName("SketchLine_20") +SketchLine_18.result().setName("SketchLine_20") +SketchLine_17.setName("SketchLine_19") +SketchLine_17.result().setName("SketchLine_19") +SketchLine_16.setName("SketchLine_18") +SketchLine_16.result().setName("SketchLine_18") +model.do() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r-SketchLine_16r_wire")], model.selection(), "h2-h3-h1", 0) +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face")) +SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_21 = SketchProjection_6.createdFeature() +SketchLine_21.setName("SketchLine_23") +SketchLine_21.result().setName("SketchLine_23") +SketchCircle_5 = Sketch_3.addCircle(0, 0, 10) +SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchAPI_Line(SketchLine_21).startPoint(), SketchCircle_5.center()) +SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_30") +SketchConstraintRadius_5 = Sketch_3.setRadius(SketchCircle_5.results()[1], 10) +model.do() +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")]) +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f")], model.selection(), 0, 60, [model.selection("SOLID", "Fuse_1_1")]) +Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/From_Face")) +SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_22 = SketchProjection_7.createdFeature() +SketchLine_22.setName("SketchLine_24") +SketchLine_22.result().setName("SketchLine_24") +SketchCircle_6 = Sketch_4.addCircle(0, 0, 12.5) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_22).startPoint(), SketchCircle_6.center()) +SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_31") +SketchConstraintRadius_6 = Sketch_4.setRadius(SketchCircle_6.results()[1], 12.5) +model.do() +ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_4f-SketchArc_11_2f-SketchLine_7f-SketchArc_5_2f-SketchLine_10f-SketchArc_8_2f-SketchLine_13f-SketchArc_10_2f-SketchLine_8f-SketchArc_6_2f-SketchLine_11f-SketchArc_9_2f-SketchLine_14f-SketchArc_2_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")]) +Fillet_1_objects = [model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_20]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_21]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_22]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19]"), model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_18]")] +Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 1) +Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face")) +SketchProjection_8 = Sketch_5.addProjection(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchCircle_5_2]__cc"), False) +SketchPoint_5 = SketchProjection_8.createdFeature() +SketchCircle_7 = Sketch_5.addCircle(0, 0, 22) +SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchPoint_5.result(), SketchCircle_7.center()) +SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32") +SketchConstraintRadius_7 = Sketch_5.setRadius(SketchCircle_7.results()[1], 22) +model.do() +Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f")], model.selection(), "h3", 0) +Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fillet_1_1"), model.selection("SOLID", "Extrusion_3_1")]) +Sketch_6 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) +SketchLine_23 = Sketch_6.addLine(22, 70, 20, 70) +SketchLine_23.setName("SketchLine_25") +SketchLine_23.result().setName("SketchLine_25") +SketchProjection_9 = Sketch_6.addProjection(model.selection("VERTEX", "[Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face]"), False) +SketchPoint_6 = SketchProjection_9.createdFeature() +SketchConstraintCoincidence_29 = Sketch_6.setCoincident(SketchLine_23.startPoint(), SketchPoint_6.result()) +SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33") +SketchLine_24 = Sketch_6.addLine(20, 70, 22, 68.84529946162075) +SketchLine_24.setName("SketchLine_26") +SketchLine_24.result().setName("SketchLine_26") +SketchConstraintCoincidence_30 = Sketch_6.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint()) +SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_34") +SketchProjection_10 = Sketch_6.addProjection(model.selection("EDGE", "([Extrusion_3_1/Generated_Face&Sketch_5/SketchCircle_7_2][Extrusion_3_1/To_Face])_Fuse_2_1"), False) +SketchLine_25 = SketchProjection_10.createdFeature() +SketchLine_25.setName("SketchLine_27") +SketchLine_25.result().setName("SketchLine_27") +SketchConstraintCoincidence_31 = Sketch_6.setCoincident(SketchLine_24.endPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_35") +SketchLine_26 = Sketch_6.addLine(22, 68.84529946162075, 22, 70) +SketchLine_26.setName("SketchLine_28") +SketchLine_26.result().setName("SketchLine_28") +SketchConstraintCoincidence_32 = Sketch_6.setCoincident(SketchLine_24.endPoint(), SketchLine_26.startPoint()) +SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36") +SketchConstraintCoincidence_33 = Sketch_6.setCoincident(SketchLine_23.startPoint(), SketchLine_26.endPoint()) +SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_37") +SketchLine_27 = Sketch_6.addLine(21.99999999999999, 64, 22, 63) +SketchLine_27.setName("SketchLine_29") +SketchLine_27.result().setName("SketchLine_29") +SketchConstraintCoincidence_34 = Sketch_6.setCoincident(SketchLine_27.startPoint(), SketchLine_25.result()) +SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_38") +SketchConstraintCoincidence_35 = Sketch_6.setCoincident(SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_27.endPoint()) +SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_39") +SketchLine_28 = Sketch_6.addLine(21.99999999999999, 64, 21.73205080756888, 63) +SketchLine_28.setName("SketchLine_30") +SketchLine_28.result().setName("SketchLine_30") +SketchConstraintCoincidence_36 = Sketch_6.setCoincident(SketchLine_27.startPoint(), SketchLine_28.startPoint()) +SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_40") +SketchLine_29 = Sketch_6.addLine(21.73205080756888, 63, 22, 63) +SketchLine_29.setName("SketchLine_31") +SketchLine_29.result().setName("SketchLine_31") +SketchConstraintCoincidence_37 = Sketch_6.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint()) +SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_41") +SketchConstraintCoincidence_38 = Sketch_6.setCoincident(SketchAPI_Line(SketchLine_25).startPoint(), SketchLine_29.endPoint()) +SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_42") +SketchConstraintLength_1 = Sketch_6.setLength(SketchLine_23.result(), 2) +SketchConstraintAngle_2 = Sketch_6.setAngleBackward(SketchLine_23.result(), SketchLine_24.result(), 30) +SketchConstraintHorizontal_2 = Sketch_6.setHorizontal(SketchLine_23.result()) +SketchConstraintHorizontal_2.setName("SketchConstraintHorizontal_3") +SketchConstraintHorizontal_3 = Sketch_6.setHorizontal(SketchLine_29.result()) +SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4") +SketchConstraintLength_2 = Sketch_6.setLength(SketchLine_27.result(), 1) +SketchConstraintAngle_3 = Sketch_6.setAngle(SketchLine_28.result(), SketchLine_27.result(), 15) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Fuse_2_1")], [model.selection("SOLID", "Revolution_1_2"), model.selection("SOLID", "Revolution_1_1")]) +Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Cut_1_1/Modified_Face&Extrusion_3_1/To_Face")) +SketchProjection_11 = Sketch_7.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_6/SketchLine_26][Cut_1_1/Modified_Face&Extrusion_3_1/To_Face]__cc"), False) +SketchPoint_7 = SketchProjection_11.createdFeature() +SketchCircle_8 = Sketch_7.addCircle(0, 0, 26) +SketchCircle_8.setAuxiliary(True) +SketchConstraintCoincidence_39 = Sketch_7.setCoincident(SketchPoint_7.result(), SketchCircle_8.center()) +SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_43") +SketchConstraintRadius_8 = Sketch_7.setRadius(SketchCircle_8.results()[1], 26) +SketchCircle_9 = Sketch_7.addCircle(0, -26, 5.25) +SketchConstraintCoincidence_40 = Sketch_7.setCoincident(SketchCircle_8.results()[1], SketchCircle_9.center()) +SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_44") +SketchProjection_12 = Sketch_7.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_30 = SketchProjection_12.createdFeature() +SketchLine_30.setName("SketchLine_32") +SketchLine_30.result().setName("SketchLine_32") +SketchConstraintRadius_9 = Sketch_7.setRadius(SketchCircle_9.results()[1], 5.25) +SketchConstraintCoincidence_41 = Sketch_7.setCoincident(SketchCircle_9.center(), SketchLine_30.result()) +SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_45") +SketchMultiRotation_4 = Sketch_7.addRotation([SketchCircle_9.results()[1]], SketchAPI_Line(SketchLine_30).startPoint(), 360, 16, True) +[SketchCircle_10, SketchCircle_11, SketchCircle_12, SketchCircle_13, SketchCircle_14, SketchCircle_15, SketchCircle_16, SketchCircle_17, SketchCircle_18, SketchCircle_19, SketchCircle_20, SketchCircle_21, SketchCircle_22, SketchCircle_23, SketchCircle_24] = SketchMultiRotation_4.rotated() +model.do() +Extrusion_4_objects = [model.selection("FACE", "Sketch_7/Face-SketchCircle_19_2f-SketchCircle_20_2r-SketchCircle_19_2f-SketchCircle_19_2f-SketchCircle_18_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_18_2f-SketchCircle_19_2r-SketchCircle_18_2f-SketchCircle_17_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_17_2f-SketchCircle_18_2r-SketchCircle_18_2r-SketchCircle_17_2f-SketchCircle_16_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_15_2f-SketchCircle_15_2f-SketchCircle_16_2r-SketchCircle_15_2f-SketchCircle_14_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_16_2f-SketchCircle_16_2f-SketchCircle_17_2r-SketchCircle_17_2r-SketchCircle_16_2f-SketchCircle_15_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_14_2f-SketchCircle_14_2f-SketchCircle_15_2r-SketchCircle_14_2f-SketchCircle_13_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_13_2f-SketchCircle_13_2f-SketchCircle_14_2r-SketchCircle_13_2f-SketchCircle_12_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_12_2f-SketchCircle_12_2f-SketchCircle_13_2r-SketchCircle_12_2f-SketchCircle_11_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_11_2f-SketchCircle_11_2f-SketchCircle_12_2r-SketchCircle_11_2f-SketchCircle_10_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_9_2r-SketchCircle_10_2f-SketchCircle_10_2f-SketchCircle_11_2r-SketchCircle_10_2f-SketchCircle_9_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_9_2f-SketchCircle_24_2r-SketchCircle_24_2r-SketchCircle_9_2f-SketchCircle_10_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_24_2f-SketchCircle_23_2r-SketchCircle_24_2f-SketchCircle_9_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_23_2f-SketchCircle_24_2r-SketchCircle_23_2f-SketchCircle_23_2f-SketchCircle_22_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_22_2f-SketchCircle_23_2r-SketchCircle_22_2f-SketchCircle_22_2f-SketchCircle_21_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_21_2f-SketchCircle_22_2r-SketchCircle_21_2f-SketchCircle_21_2f-SketchCircle_20_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_20_2f-SketchCircle_21_2r-SketchCircle_20_2f-SketchCircle_20_2f-SketchCircle_19_2r")] +Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection(), model.selection("FACE", "Sketch_5/Face-SketchCircle_7_2f"), 0, model.selection(), 0) +Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], [model.selection("COMPOUND", "all-in-Extrusion_4")]) +Sketch_8 = model.addSketch(Part_1_doc, model.standardPlane("XOZ")) +SketchLine_31 = Sketch_8.addLine(0, 97, 4.25, 97) +SketchLine_31.setName("SketchLine_33") +SketchLine_31.result().setName("SketchLine_33") +SketchProjection_13 = Sketch_8.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_32 = SketchProjection_13.createdFeature() +SketchLine_32.setName("SketchLine_34") +SketchLine_32.result().setName("SketchLine_34") +SketchConstraintCoincidence_42 = Sketch_8.setCoincident(SketchLine_31.startPoint(), SketchLine_32.result()) +SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_46") +SketchLine_33 = Sketch_8.addLine(4.25, 97, 4.25, 91.05) +SketchLine_33.setName("SketchLine_35") +SketchLine_33.result().setName("SketchLine_35") +SketchConstraintCoincidence_43 = Sketch_8.setCoincident(SketchLine_31.endPoint(), SketchLine_33.startPoint()) +SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_47") +SketchLine_34 = Sketch_8.addLine(4.25, 91.05, 6, 89.3) +SketchLine_34.setName("SketchLine_36") +SketchLine_34.result().setName("SketchLine_36") +SketchConstraintCoincidence_44 = Sketch_8.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint()) +SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_48") +SketchLine_35 = Sketch_8.addLine(6, 89.3, 6, 70) +SketchLine_35.setName("SketchLine_37") +SketchLine_35.result().setName("SketchLine_37") +SketchConstraintCoincidence_45 = Sketch_8.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint()) +SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_49") +SketchLine_36 = Sketch_8.addLine(6, 70, 0, 70) +SketchLine_36.setName("SketchLine_38") +SketchLine_36.result().setName("SketchLine_38") +SketchConstraintCoincidence_46 = Sketch_8.setCoincident(SketchLine_35.endPoint(), SketchLine_36.startPoint()) +SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_50") +SketchProjection_14 = Sketch_8.addProjection(model.selection("VERTEX", "Sketch_7/SketchCircle_8"), False) +SketchPoint_8 = SketchProjection_14.createdFeature() +SketchConstraintCoincidence_47 = Sketch_8.setCoincident(SketchLine_36.endPoint(), SketchPoint_8.result()) +SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_51") +SketchLine_37 = Sketch_8.addLine(0, 70, 0, 97) +SketchLine_37.setName("SketchLine_39") +SketchLine_37.result().setName("SketchLine_39") +SketchConstraintCoincidence_48 = Sketch_8.setCoincident(SketchLine_36.endPoint(), SketchLine_37.startPoint()) +SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_52") +SketchConstraintCoincidence_49 = Sketch_8.setCoincident(SketchLine_31.startPoint(), SketchLine_37.endPoint()) +SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_53") +SketchConstraintHorizontal_4 = Sketch_8.setHorizontal(SketchLine_36.result()) +SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_5") +SketchConstraintHorizontal_5 = Sketch_8.setHorizontal(SketchLine_31.result()) +SketchConstraintHorizontal_5.setName("SketchConstraintHorizontal_6") +SketchConstraintVertical_3 = Sketch_8.setVertical(SketchLine_33.result()) +SketchConstraintVertical_4 = Sketch_8.setVertical(SketchLine_35.result()) +SketchConstraintLength_3 = Sketch_8.setLength(SketchLine_31.result(), 4.25) +SketchConstraintLength_4 = Sketch_8.setLength(SketchLine_36.result(), 6) +SketchConstraintLength_5 = Sketch_8.setLength(SketchLine_35.result(), 19.3) +SketchConstraintAngle_4 = Sketch_8.setAngle(SketchLine_34.result(), SketchLine_31.result(), 45) +SketchProjection_15 = Sketch_8.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_38 = SketchProjection_15.createdFeature() +SketchLine_38.setName("SketchLine_40") +SketchLine_38.result().setName("SketchLine_40") +SketchConstraintDistance_5 = Sketch_8.setDistance(SketchLine_33.startPoint(), SketchLine_38.result(), 97, True) +model.do() +Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_39r-SketchLine_38r-SketchLine_37r-SketchLine_36r-SketchLine_35r-SketchLine_33r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Fuse_3 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cut_2_1"), model.selection("SOLID", "Revolution_2_1")]) +Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fuse_3_1/Modified_Face&Extrusion_3_1/To_Face][Revolution_2_1/Generated_Face&Sketch_8/SketchLine_37]")], 1) +model.testHaveNamingSubshapes(Fillet_2, model, Part_1_doc) +Group_4_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_2_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_3_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_4_2")] +Group_4 = model.addGroup(Part_1_doc, Group_4_objects) +Group_4.setName("SCREW") +Group_4.result().setName("SCREW") +Group_5 = model.addGroup(Part_1_doc, [model.selection("FACE", "Revolution_2_1/Generated_Face&Sketch_8/SketchLine_33")]) +Group_5.setName("TOP") +Group_5.result().setName("TOP") +model.do() +model.end() + +from GeomAPI import GeomAPI_Shape + +model.testNbResults(Fillet_2, 1) +model.testNbSubResults(Fillet_2, [0]) +model.testNbSubShapes(Fillet_2, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(Fillet_2, GeomAPI_Shape.FACE, [98]) +model.testNbSubShapes(Fillet_2, GeomAPI_Shape.EDGE, [528]) +model.testNbSubShapes(Fillet_2, GeomAPI_Shape.VERTEX, [1056]) +model.testResultsVolumes(Fillet_2, [41200.919845003852969966828823090]) + +from ModelAPI import * +aFactory = ModelAPI_Session.get().validators() + +# Check that the features are not in error +for i in range(Part_1_doc.size("Features")): + feature = objectToFeature(Part_1_doc.object("Features", i)) + name = feature.name() + error = feature.error() + assert(error == ''), "The feature {0} is in error: {1}".format(name, error) + assert(aFactory.validate(feature)), "The feature {0} is in error: {1}".format(name, error) + +assert(Part_1_doc.size("Groups") == 5) + +assert(model.checkPythonDump()) \ No newline at end of file