From: azv Date: Thu, 11 Jan 2018 05:28:06 +0000 (+0300) Subject: Improve 'flange' model to avoid instability in results X-Git-Tag: V_3.0.0RC1~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=089b7859b96497f1a6e55be6250cf9042d3b055f;p=modules%2Fshaper.git Improve 'flange' model to avoid instability in results --- diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index c412f3ea3..f6f4cb7a1 100755 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -47,7 +47,7 @@ #include Model_Update MY_UPDATER_INSTANCE; /// the only one instance initialized on load of the library -#define DEB_UPDATE +//#define DEB_UPDATE Model_Update::Model_Update() { diff --git a/test.models/flange.py b/test.models/flange.py index 1ba0b32c8..1015b0598 100644 --- a/test.models/flange.py +++ b/test.models/flange.py @@ -49,7 +49,6 @@ SketchArc_4 = Sketch_1.addArc(-46.475800154489, 28, -23.64558253474002, 44.21052 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_4.startPoint()) SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_5.endPoint()) SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], 12) -SketchConstraintRadius_1.setName("SketchConstraintRadius_3") SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_3.results()[1]) SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_3.result()) SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_4.center(), SketchArc_3.center()) @@ -65,59 +64,51 @@ SketchConstraintMirror_1_objects = [SketchArc_2.results()[1], SketchArc_4.result SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), SketchConstraintMirror_1_objects) [SketchArc_5, SketchArc_6, SketchLine_6, SketchLine_7, SketchLine_8, SketchArc_7, SketchArc_8] = SketchConstraintMirror_1.mirrored() SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], "dint/2") -SketchConstraintRadius_2.setName("SketchConstraintRadius_5") model.do() Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_2_2r-SketchArc_3_2r-SketchArc_4_2f-SketchArc_5_2r-SketchArc_6_2f-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchArc_7_2r-SketchArc_8_2f")], model.selection(), 35, 35) Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) -SketchArc_9 = Sketch_2.addArc(-0.6283186887989762, 106, 0, 78.00705060867459, 0, 133.9929493913254, True) +SketchArc_9 = Sketch_2.addArc(0, 106, 0, 78, 0, 134, True) SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_9.results()[1], 28) -SketchConstraintRadius_3.setName("SketchConstraintRadius_4") SketchLine_9 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OX")) SketchConstraintDistance_3 = Sketch_2.setDistance(SketchArc_9.center(), SketchLine_9.result(), "61+dint/2+thick") SketchLine_10 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ")) SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchArc_9.startPoint(), SketchLine_10.result()) SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_10.result()) -SketchLine_11 = Sketch_2.addLine(0, 78.00705060867459, 0, 133.9929493913254) -SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchArc_9.startPoint(), SketchLine_11.startPoint()) -SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_11.endPoint()) +SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchArc_9.center(), SketchLine_10.result()) +SketchLine_11 = Sketch_2.addLine(0, 78, 0, 134) +SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchArc_9.startPoint(), SketchLine_11.startPoint()) +SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_11.endPoint()) model.do() Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_9_2f-SketchLine_11f")], model.selection("EDGE", "PartSet/OZ"), 360, 0) Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_1_1")]) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ")) -SketchLine_12 = Sketch_3.addLine(2.220446049250313e-016, 106, -4, 106) +SketchLine_12 = Sketch_3.addLine(0, 106, -4, 106) SketchLine_13 = Sketch_3.addLine(-4, 106, -4, 67.34428877022477) -SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) -SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18") +SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint()) SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_12.result()) SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_13.result()) SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchConstraintDistance_4 = Sketch_3.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "61+90/2") -SketchConstraintDistance_4.setName("SketchConstraintDistance_5") SketchLine_14 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ")) SketchLine_14.setName("SketchLine_15") SketchLine_14.result().setName("SketchLine_15") -SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_12.startPoint(), SketchLine_14.result()) -SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20") +SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_12.startPoint(), SketchLine_14.result()) SketchConstraintLength_2 = Sketch_3.setLength(SketchLine_12.result(), "8/2") SketchArc_10 = Sketch_3.addArc(0, 61, -4, 67.34428877022477, 4, 67.34428877022477, False) -SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_14.result(), SketchArc_10.center()) +SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.result(), SketchArc_10.center()) SketchConstraintRadius_4 = Sketch_3.setRadius(SketchArc_10.results()[1], "15/2") -SketchConstraintRadius_4.setName("SketchConstraintRadius_6") SketchLine_15 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY")) SketchLine_15.setName("SketchLine_16") SketchLine_15.result().setName("SketchLine_16") SketchConstraintDistance_5 = Sketch_3.setDistance(SketchArc_10.center(), SketchLine_15.result(), 61) -SketchConstraintDistance_5.setName("SketchConstraintDistance_6") -SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchArc_10.startPoint()) -SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_21") +SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchArc_10.startPoint()) SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_14.result(), [SketchLine_13.result(), SketchLine_12.result()]) [SketchLine_16, SketchLine_17] = SketchConstraintMirror_2.mirrored() SketchLine_17.setName("SketchLine_18") SketchLine_17.result().setName("SketchLine_18") SketchLine_16.setName("SketchLine_17") SketchLine_16.result().setName("SketchLine_17") -SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_16.result()) -SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_22") +SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_16.result()) model.do() Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_12f-SketchLine_13f-SketchLine_17r-SketchLine_18r-SketchArc_10_2f")], model.selection(), "172/2", "172/2") Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Boolean_1_1")], [model.selection("SOLID", "Extrusion_2_1")]) @@ -130,37 +121,28 @@ SketchConstraintVertical_3 = Sketch_4.setVertical(SketchLine_18.result()) SketchConstraintLength_3 = Sketch_4.setLength(SketchLine_18.result(), 32) SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin")) SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_2.coordinates(), SketchLine_18.result(), "130/2") -SketchConstraintDistance_6.setName("SketchConstraintDistance_7") SketchPoint_3 = Sketch_4.addPoint(-65, 0) SketchPoint_3.setAuxiliary(True) SketchConstraintMiddle_1 = Sketch_4.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_18.result()) SketchLine_19 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OX")) SketchLine_19.setName("SketchLine_20") SketchLine_19.result().setName("SketchLine_20") -SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchPoint_3.coordinates(), SketchLine_19.result()) -SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_23") +SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchPoint_3.coordinates(), SketchLine_19.result()) SketchArc_11 = Sketch_4.addArc(-65, 16, -59, 16, -71, 16, False) -SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_18.startPoint(), SketchArc_11.center()) -SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_24") +SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_18.startPoint(), SketchArc_11.center()) SketchArc_12 = Sketch_4.addArc(-65, -16, -59, -16.00003459934639, -71, -16, True) -SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_18.endPoint(), SketchArc_12.center()) -SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_25") +SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_18.endPoint(), SketchArc_12.center()) SketchConstraintRadius_5 = Sketch_4.setRadius(SketchArc_11.results()[1], 6) -SketchConstraintRadius_5.setName("SketchConstraintRadius_7") SketchLine_20 = Sketch_4.addLine(-71, 16, -71, -16) SketchLine_20.setName("SketchLine_21") SketchLine_20.result().setName("SketchLine_21") -SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchArc_11.endPoint(), SketchLine_20.startPoint()) -SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_26") -SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchArc_12.endPoint(), SketchLine_20.endPoint()) -SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_27") +SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchArc_11.endPoint(), SketchLine_20.startPoint()) +SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchArc_12.endPoint(), SketchLine_20.endPoint()) SketchLine_21 = Sketch_4.addLine(-59, 16, -59, -16.00003459934639) SketchLine_21.setName("SketchLine_22") SketchLine_21.result().setName("SketchLine_22") -SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchArc_11.startPoint(), SketchLine_21.startPoint()) -SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_28") -SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchArc_12.startPoint(), SketchLine_21.endPoint()) -SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_29") +SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchArc_11.startPoint(), SketchLine_21.startPoint()) +SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchArc_12.startPoint(), SketchLine_21.endPoint()) SketchConstraintVertical_4 = Sketch_4.setVertical(SketchLine_20.result()) SketchConstraintVertical_5 = Sketch_4.setVertical(SketchLine_21.result()) SketchConstraintTangent_5 = Sketch_4.setTangent(SketchLine_20.result(), SketchArc_11.results()[1]) @@ -177,7 +159,7 @@ Parameter_dint.setValue(62) Parameter_thick.setValue(20) Parameter_length.setValue(200) model.do() -model.testResultsVolumes(Boolean_3, [407959.406418853614013642072677612]) +model.testResultsVolumes(Boolean_3, [409550.515091864974237978458404541]) Parameter_dint.setValue(58) Parameter_thick.setValue(16) Parameter_length.setValue(172) @@ -192,6 +174,6 @@ model.testNbSubShapes(Boolean_3, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Boolean_3, GeomAPI_Shape.FACE, [32]) model.testNbSubShapes(Boolean_3, GeomAPI_Shape.EDGE, [192]) model.testNbSubShapes(Boolean_3, GeomAPI_Shape.VERTEX, [384]) -model.testResultsVolumes(Boolean_3, [305733.913411944580730050802230835]) +model.testResultsVolumes(Boolean_3, [307084.534467286430299282073974609]) assert(model.checkPythonDump())