Salome HOME
Add more tests for update of the sketcher behavior check
[modules/shaper.git] / test.models / case24.py
index 65afa9b008a1e7354b69624e1aaa22f4b83b417c..247658ae5e1d21dc97f7c3c2d086e49a828e6d4f 100644 (file)
@@ -1,3 +1,23 @@
+## 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<mailto:webmaster.salome@opencascade.com>
+##
+
 from SketchAPI import *
 
 from salome.shaper import model
@@ -6,6 +26,7 @@ model.begin()
 partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
+Parameter_R = model.addParameter(Part_1_doc, "R", "3")
 model.addParameter(Part_1_doc, "DBody", "65")
 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 89, False)
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
@@ -54,7 +75,7 @@ SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.startPoint()
 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_4.endPoint())
 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_6.result())
 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_5.result())
-SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 3)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R")
 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchAPI_Line(SketchLine_7).startPoint())
 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_3.result(), 20)
 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_2.result(), 20)
@@ -113,7 +134,7 @@ SketchLine_15.result().setName("SketchLine_19")
 SketchLine_16 = Sketch_3.addLine(-20, 0, 0, 0)
 SketchLine_16.setName("SketchLine_15")
 SketchLine_16.result().setName("SketchLine_15")
-SketchPoint_2 = Sketch_3.addPoint(model.selection("VERTEX", "ExtrusionFuse_2_1/Modfied_7&ExtrusionFuse_2_1/Modfied_5&ExtrusionFuse_2_1/Modfied_8&ExtrusionFuse_2_1/Modfied_11"))
+SketchPoint_2 = Sketch_3.addPoint(model.selection("VERTEX", "ExtrusionFuse_2_1/Modfied_7&ExtrusionFuse_2_1/Modfied_6&ExtrusionFuse_2_1/Modfied_8&ExtrusionFuse_2_1/Modfied_9"))
 SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchPoint_2.result())
 SketchLine_17 = Sketch_3.addLine(0, 0, 0, -20)
 SketchLine_17.setName("SketchLine_16")
@@ -412,7 +433,7 @@ SketchLine_54.result().setName("SketchLine_55")
 SketchLine_54.setAuxiliary(True)
 SketchConstraintCoincidence_86 = Sketch_7.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint())
 SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_96")
-SketchLine_55 = Sketch_7.addLine(model.selection("EDGE", "RevolutionFuse_3_1/Modfied_13&RevolutionFuse_3_1/Modfied_10"))
+SketchLine_55 = Sketch_7.addLine(model.selection("EDGE", "RevolutionFuse_3_1/Modfied_11&RevolutionFuse_3_1/Modfied_8"))
 SketchLine_55.setName("SketchLine_56")
 SketchLine_55.result().setName("SketchLine_56")
 SketchConstraintCoincidence_87 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_55.result())
@@ -627,7 +648,7 @@ Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOY"))
 SketchLine_77 = Sketch_10.addLine(64, 20, 89, 20)
 SketchLine_77.setName("SketchLine_76")
 SketchLine_77.result().setName("SketchLine_76")
-SketchPoint_4 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_2_1/Modfied_11&RevolutionFuse_2_1/Modfied_13&RevolutionFuse_3_1/Modfied_15&RevolutionFuse_3_1/Modfied_4"))
+SketchPoint_4 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_2_1/Modfied_9&RevolutionFuse_2_1/Modfied_12&RevolutionFuse_3_1/Modfied_12&RevolutionFuse_3_1/Modfied_1divided_f_1"))
 SketchConstraintCoincidence_122 = Sketch_10.setCoincident(SketchLine_77.startPoint(), SketchPoint_4.result())
 SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_120")
 SketchPoint_5 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_8e-SketchLine_4e"))
@@ -636,10 +657,10 @@ SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_121")
 SketchLine_78 = Sketch_10.addLine(64, -20, 89, -20)
 SketchLine_78.setName("SketchLine_77")
 SketchLine_78.result().setName("SketchLine_77")
-SketchPoint_6 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_1_1/Modfied_4&RevolutionFuse_1_1/Modfied_9&RevolutionFuse_3_1/Modfied_17&RevolutionFuse_3_1/Modfied_8"))
+SketchPoint_6 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_1_1/Modfied_4&RevolutionFuse_1_1/Modfied_10&RevolutionFuse_3_1/Modfied_13&RevolutionFuse_3_1/Modfied_1divided_f_2"))
 SketchConstraintCoincidence_124 = Sketch_10.setCoincident(SketchLine_78.startPoint(), SketchPoint_6.result())
 SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_122")
-SketchPoint_7 = Sketch_10.addPoint(model.selection("VERTEX", "ExtrusionFuse_2_1/Modfied_2&RevolutionFuse_1_1/Modfied_4&ExtrusionFuse_2_1/Modfied_1&RevolutionFuse_3_1/Modfied_17"))
+SketchPoint_7 = Sketch_10.addPoint(model.selection("VERTEX", "ExtrusionFuse_2_1/Modfied_3&RevolutionFuse_1_1/Modfied_4&ExtrusionFuse_2_1/Modfied_4&RevolutionFuse_3_1/Modfied_13"))
 SketchConstraintCoincidence_125 = Sketch_10.setCoincident(SketchLine_78.endPoint(), SketchPoint_7.result())
 SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_123")
 SketchArc_10 = Sketch_10.addArc(89.00000104846708, 1.669244441022778e-015, 89, -20, 89, 20, False)
@@ -662,7 +683,7 @@ SketchConstraintCoincidence_129 = Sketch_10.setCoincident(SketchArc_11.startPoin
 SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_127")
 SketchConstraintTangent_19 = Sketch_10.setTangent(SketchArc_11.results()[1], SketchLine_78.result())
 SketchConstraintTangent_19.setName("SketchConstraintTangent_24")
-SketchPoint_8 = Sketch_10.addPoint(model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_9&RevolutionFuse_3_1/Modfied_7&RevolutionFuse_3_1/Modfied_8&RevolutionFuse_3_1/Modfied_24&RevolutionFuse_3_1/Modfied_9"))
+SketchPoint_8 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_1_1/Modfied_10&RevolutionFuse_3_1/Modfied_7&RevolutionFuse_3_1/Modfied_1divided_f_2"))
 SketchConstraintCoincidence_130 = Sketch_10.setCoincident(SketchArc_11.endPoint(), SketchPoint_8.result())
 SketchConstraintCoincidence_130.setName("SketchConstraintCoincidence_128")
 SketchArc_12 = Sketch_10.addArc(64.00001789135865, 23.01137360115889, 64, 20, 61.15622559702543, 22.02080994708722, True)
@@ -673,7 +694,7 @@ SketchConstraintCoincidence_131 = Sketch_10.setCoincident(SketchArc_12.startPoin
 SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_129")
 SketchConstraintTangent_20 = Sketch_10.setTangent(SketchArc_12.results()[1], SketchLine_77.result())
 SketchConstraintTangent_20.setName("SketchConstraintTangent_25")
-SketchPoint_9 = Sketch_10.addPoint(model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_9&RevolutionFuse_3_1/Modfied_3&RevolutionFuse_3_1/Modfied_4&RevolutionFuse_3_1/Modfied_24&RevolutionFuse_3_1/Modfied_5"))
+SketchPoint_9 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_2_1/Modfied_12&RevolutionFuse_3_1/Modfied_4&RevolutionFuse_3_1/Modfied_1divided_f_1"))
 SketchConstraintCoincidence_132 = Sketch_10.setCoincident(SketchArc_12.endPoint(), SketchPoint_9.result())
 SketchConstraintCoincidence_132.setName("SketchConstraintCoincidence_130")
 SketchLine_79 = Sketch_10.addLine(61.15622559702543, 22.02080994708722, 59.81204392543111, 22.0208099470871)
@@ -763,6 +784,12 @@ model.do()
 RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "PartSet/OZ"), 0, 360, [model.selection("SOLID", "ExtrusionFuse_3_1")])
 ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_11/Wire-SketchCircle_4_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_3_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_5_2f")], model.selection(), 30, -15, [model.selection("SOLID", "RevolutionCut_1_1")])
 ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_11/Wire-SketchCircle_2_2f"), model.selection("FACE", "Sketch_11/Face-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_7_2f")], model.selection(), 30, 2, [model.selection("SOLID", "ExtrusionCut_3_1")])
+
+# Test reexecution after parameter change
+Parameter_R.setValue(5)
+model.do()
+model.testResultsVolumes(ExtrusionCut_4, [502616.749082866765093058347702026])
+Parameter_R.setValue(3)
 model.end()
 
 from GeomAPI import GeomAPI_Shape
@@ -771,8 +798,8 @@ model.testNbResults(ExtrusionCut_4, 1)
 model.testNbSubResults(ExtrusionCut_4, [0])
 model.testNbSubShapes(ExtrusionCut_4, GeomAPI_Shape.SOLID, [1])
 model.testNbSubShapes(ExtrusionCut_4, GeomAPI_Shape.FACE, [81])
-model.testNbSubShapes(ExtrusionCut_4, GeomAPI_Shape.EDGE, [406])
-model.testNbSubShapes(ExtrusionCut_4, GeomAPI_Shape.VERTEX, [812])
-model.testResultsVolumes(ExtrusionCut_4, [502902.431481667619664222002029419])
+model.testNbSubShapes(ExtrusionCut_4, GeomAPI_Shape.EDGE, [410])
+model.testNbSubShapes(ExtrusionCut_4, GeomAPI_Shape.VERTEX, [820])
+model.testResultsVolumes(ExtrusionCut_4, [502903.236060981987975537776947021])
 
 assert(model.checkPythonDump())