X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=test.models%2Fgear.py;h=202410366b461f5a02376a8bfaa8d2912bae0181;hb=1849303ee39b0c01418323fb4d9ab4b28e8149b8;hp=a25353b364bea9d87ca374a57e055c42289ef551;hpb=46aa3024234701a2e73ef90c378ae4bf414d90f7;p=modules%2Fshaper.git diff --git a/test.models/gear.py b/test.models/gear.py index a25353b36..202410366 100644 --- a/test.models/gear.py +++ b/test.models/gear.py @@ -1,9 +1,29 @@ +# 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 * from salome.shaper import model model.begin() partSet = model.moduleDocument() +Parameter_R = model.addParameter(partSet, "R", "15.5") Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(0, 0, 30, 0) SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin")) @@ -25,18 +45,17 @@ SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) -SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result()) SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_8.result(), 30) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 37.5) -SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_8.result(), 15.5) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_8.result(), "R") SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.coordinates()) SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_4.result(), 13) SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_1.startPoint()) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Parameter_R = model.addParameter(Part_1_doc, "R", "15") +model.addParameter(Part_1_doc, "R_fillet", "0.5") Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ")) SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchLine_9 = Sketch_2.addLine(0, 0, 0, 45.59203984275747) @@ -108,36 +127,42 @@ SketchLine_79 = Sketch_3.addLine(0, 0, 0, 15) SketchLine_79.setAuxiliary(True) SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_79.startPoint(), SketchPoint_3.result()) SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_79.result()) -SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_79.result(), "R") +SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_79.result(), "R-R_fillet") SketchLine_80 = Sketch_3.addLine(0, 15, 0.5, 15) SketchLine_80.setAuxiliary(True) SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchLine_80.startPoint()) SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_80.result()) -SketchArc_61 = Sketch_3.addArc(0.5, 15, 0, 15, 0.4999999999999999, 15.5, True) +SketchArc_61 = Sketch_3.addArc(0.5, 15, 0, 15, 0.5, 15.5, True) SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_80.endPoint(), SketchArc_61.center()) SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchArc_61.startPoint()) SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_80.startPoint(), SketchArc_61.startPoint()) -SketchLine_81 = Sketch_3.addLine(0.5, 15, 0.5, 15.66051714754979) +SketchLine_81 = Sketch_3.addLine(0.5, 15, 0.5, 16) SketchLine_81.setAuxiliary(True) SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_80.endPoint(), SketchLine_81.startPoint()) SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchArc_61.center(), SketchLine_81.startPoint()) SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_81.result()) SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchArc_61.endPoint(), SketchLine_81.result()) -SketchConstraintRadius_3 = Sketch_3.setRadius(SketchArc_61.results()[1], 0.5) -SketchLine_82 = Sketch_3.addLine(0.4999999999999999, 15.5, 0.4988301186899768, 15.74914940994379) +SketchConstraintRadius_3 = Sketch_3.setRadius(SketchArc_61.results()[1], "R_fillet") +SketchLine_82 = Sketch_3.addLine(0.5, 15.5, 0.5, 16) SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchArc_61.endPoint(), SketchLine_82.startPoint()) -SketchLine_83 = Sketch_3.addLine(0.4988301186899768, 15.74914940994379, -0.3081878496471824, 15.75231418629021) +SketchLine_83 = Sketch_3.addLine(0.5, 16, -0.5, 16) SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_82.endPoint(), SketchLine_83.startPoint()) -SketchLine_84 = Sketch_3.addLine(-0.3081878496471824, 15.75231418629021, -0.3081878496471824, 14.99276786314936) +SketchLine_84 = Sketch_3.addLine(-0.5, 16, -0.5, 15) SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_83.endPoint(), SketchLine_84.startPoint()) -SketchLine_85 = Sketch_3.addLine(-0.3081878496471824, 14.99276786314936, 0, 15) +SketchLine_85 = Sketch_3.addLine(-0.5, 15, 0, 15) SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_84.endPoint(), SketchLine_85.startPoint()) SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_79.endPoint(), SketchLine_85.endPoint()) SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_80.startPoint(), SketchLine_85.endPoint()) SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchArc_61.startPoint(), SketchLine_85.endPoint()) +SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_81.endPoint(), SketchLine_83.startPoint()) +SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_85.startPoint(), SketchLine_80.result()) +SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_84.result()) +SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_83.result()) +SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_84.result(), "2*R_fillet") +SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_83.result(), "2*R_fillet") model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_1"), 360, 0) -Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_5")) +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/SketchLine_1"), 360, 0) +Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_8")) SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchLine_86 = Sketch_4.addLine(0, -13.49999999999519, 3.1, -13.49999999999519) SketchLine_87 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OZ")) @@ -169,25 +194,26 @@ SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchPoint_6.coordinate SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_6.coordinates(), SketchLine_89.result()) SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_6.coordinates(), SketchLine_86.result(), 24.5) model.do() -ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")]) +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_3"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")]) RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "PartSet/OX"), 0, 360, [model.selection("SOLID", "ExtrusionCut_1_1")]) +ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 0, 5, [model.selection("SOLID", "RevolutionCut_1_1")]) model.do() # Test reexecution after parameter change Parameter_R.setValue(16) model.do() -model.testResultsVolumes(RevolutionCut_1, [65207.601331337653391528874635696]) +model.testResultsVolumes(ExtrusionCut_2, [64060.674439985647040884941816330]) Parameter_R.setValue(15) model.end() from GeomAPI import GeomAPI_Shape -model.testNbResults(RevolutionCut_1, 1) -model.testNbSubResults(RevolutionCut_1, [0]) -model.testNbSubShapes(RevolutionCut_1, GeomAPI_Shape.SOLID, [1]) -model.testNbSubShapes(RevolutionCut_1, GeomAPI_Shape.FACE, [218]) -model.testNbSubShapes(RevolutionCut_1, GeomAPI_Shape.EDGE, [1284]) -model.testNbSubShapes(RevolutionCut_1, GeomAPI_Shape.VERTEX, [2568]) -model.testResultsVolumes(RevolutionCut_1, [65202.414255050614883657544851303]) +model.testNbResults(ExtrusionCut_2, 1) +model.testNbSubResults(ExtrusionCut_2, [0]) +model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.SOLID, [1]) +model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.FACE, [224]) +model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.EDGE, [1314]) +model.testNbSubShapes(ExtrusionCut_2, GeomAPI_Shape.VERTEX, [2628]) +model.testResultsVolumes(ExtrusionCut_2, [62405.392187037912663072347640991]) assert(model.checkPythonDump())