X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FTest%2FTestCustomName_CutGroup.py;h=a3ff2c309f65df8a732da0187e1765a7b8020835;hb=ac53df4563f345f48d3a7274dbbb3f2618bacbda;hp=d4fb33a3077429a35fbc77e42706fb42e378d8c1;hpb=2714903267d23cd0c81166c506fb3edd1e069d40;p=modules%2Fshaper.git diff --git a/src/ModelAPI/Test/TestCustomName_CutGroup.py b/src/ModelAPI/Test/TestCustomName_CutGroup.py index d4fb33a30..a3ff2c309 100644 --- a/src/ModelAPI/Test/TestCustomName_CutGroup.py +++ b/src/ModelAPI/Test/TestCustomName_CutGroup.py @@ -1,22 +1,21 @@ -## Copyright (C) 2014-2017 CEA/DEN, EDF R&D -## -## This library is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -## -## See http:##www.salome-platform.org/ or -## email : webmaster.salome@opencascade.com -## +# Copyright (C) 2014-2019 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 * @@ -47,7 +46,7 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 40) SketchCircle_1 = Sketch_1.addCircle(30, 70, 20) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 20) SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_3.result(), 30, True) -SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchLine_2.startPoint(), -30) +SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchLine_2.startPoint(), 30) SketchLine_5 = Sketch_1.addLine(12.50000000006628, -45.31088913249455, 30, -15) SketchLine_6 = Sketch_1.addLine(30, -15, 47.50000000006629, -45.31088913249455) SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) @@ -58,20 +57,20 @@ SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_7. SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_6.result()) SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 35) -SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_2.startPoint(), -30) +SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_2.startPoint(), 30) SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_5.endPoint(), SketchLine_2.startPoint(), 15) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0) Extrusion_1.result().setName("box") -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r")], model.selection(), 20, 20) +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 20, 20) Extrusion_2.result().setName("prism") Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0) Extrusion_3.result().setName("cylinder") -Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "box/From_Face_1")) -SketchLine_8 = Sketch_2.addLine(45, 30, 25, 30) -SketchLine_9 = Sketch_2.addLine(25, 30, 25, -100) -SketchLine_10 = Sketch_2.addLine(25, -100, 45, -100) -SketchLine_11 = Sketch_2.addLine(45, -100, 45, 30) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "box/From_Face")) +SketchLine_8 = Sketch_2.addLine(45, -10, 25, -10) +SketchLine_9 = Sketch_2.addLine(25, -10, 25, -140) +SketchLine_10 = Sketch_2.addLine(25, -140, 45, -140) +SketchLine_11 = Sketch_2.addLine(45, -140, 45, -10) SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint()) SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) @@ -82,21 +81,22 @@ SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_10.result()) SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_11.result()) SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_10.result(), 20) SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_9.result(), 130) -SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "box/Generated_Face_3&box/Generated_Face_2&box/From_Face_1"), False) +SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[box/Generated_Face&Sketch_1/SketchLine_3][box/Generated_Face&Sketch_1/SketchLine_2][box/From_Face]"), False) SketchPoint_2 = SketchProjection_2.createdFeature() -SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), -30) -SketchConstraintDistanceHorizontal_3 = Sketch_2.setHorizontalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), -25) +SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 30) +SketchConstraintDistanceHorizontal_3 = Sketch_2.setHorizontalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 25) model.do() -Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f")], model.selection(), 5, 15) +Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f-SketchLine_11f")], model.selection(), 5, 15) Extrusion_4.result().setName("cut_tool") -Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "box"), model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")], [model.selection("SOLID", "cut_tool")]) +Cut_1_objects_1 = [model.selection("SOLID", "box"), model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")] +Cut_1 = model.addCut(Part_1_doc, Cut_1_objects_1, [model.selection("SOLID", "cut_tool")]) model.do() Extrusions = [Extrusion_1, Extrusion_2, Extrusion_3] -BooleanResults = Boolean_1.results() -for i in xrange(len(BooleanResults)): +BooleanResults = Cut_1.results() +for i in range(len(BooleanResults)): assert(BooleanResults[i].name() == Extrusions[i].result().name()), "Name of result {} of Boolean CUT '{}' != '{}'".format(i, BooleanResults[i].name(), Extrusions[i].result().name()) - BooleanName = Boolean_1.name() + "_" + str(i + 1) + BooleanName = Cut_1.name() + "_" + str(i + 1) for sub in range(0, BooleanResults[i].numberOfSubs()): refName = BooleanName + '_' + str(sub + 1) subResult = BooleanResults[i].subResult(sub)