]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Avoid instability in "gear.py" test model
authorazv <azv@opencascade.com>
Fri, 7 Apr 2017 07:45:04 +0000 (10:45 +0300)
committerazv <azv@opencascade.com>
Fri, 7 Apr 2017 07:52:27 +0000 (10:52 +0300)
test.models/gear.py

index a25353b364bea9d87ca374a57e055c42289ef551..f49e7960d11e95c4db31e1cd9713024867741706 100644 (file)
@@ -4,6 +4,7 @@ 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"))
@@ -29,14 +30,14 @@ 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,33 +109,39 @@ 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"))
@@ -171,23 +178,24 @@ SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_6.coordinates(), S
 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")])
 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())