From: mpv Date: Tue, 28 Aug 2018 13:48:12 +0000 (+0300) Subject: Fix: update of the sub-results number when the sub-results number is reduced in the OB X-Git-Tag: SHAPER_V9_1_0RC1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e139a7ce9d4f98a1622bdc438da9599e59f404ff;hp=3264b4a29ab742384af02f661e289633f8d7234e;p=modules%2Fshaper.git Fix: update of the sub-results number when the sub-results number is reduced in the OB --- diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 7b7ae0780..c68a4ae4b 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -93,6 +93,8 @@ int Model_ResultBody::numberOfSubs(bool forTree) const ResultBodyPtr Model_ResultBody::subResult(const int theIndex, bool forTree) const { + if (theIndex >= int(mySubs.size())) + return ResultBodyPtr(); return mySubs.at(theIndex); } diff --git a/test.models/plug.py b/test.models/plug.py index 59bbf1336..37ce6db8b 100644 --- a/test.models/plug.py +++ b/test.models/plug.py @@ -309,8 +309,8 @@ SketchConstraintAngle_5 = Sketch_3.setAngle(SketchLine_51.result(), SketchLine_4 SketchConstraintDistanceHorizontal_15 = Sketch_3.setHorizontalDistance(SketchAPI_Line(SketchLine_50).endPoint(), SketchLine_42.startPoint(), "Slot_Width") SketchConstraintDistanceVertical_5 = Sketch_3.setVerticalDistance(SketchLine_39.startPoint(), SketchLine_39.endPoint(), 8) SketchConstraintDistanceHorizontal_16 = Sketch_3.setHorizontalDistance(SketchLine_39.endPoint(), SketchAPI_Line(SketchLine_50).startPoint(), 3) -model.do() ExtrusionCut_2.setNestedSketch(Sketch_3) +model.do() # check Sketch_3 model.checkSketch(Sketch_3, 0) # check ExtrusionCut_2 @@ -401,8 +401,8 @@ SketchConstraintVertical_18 = Sketch_5.setVertical(SketchLine_63.result()) SketchConstraintHorizontal_12 = Sketch_5.setHorizontal(SketchLine_65.result()) SketchConstraintDistanceVertical_7 = Sketch_5.setVerticalDistance(SketchLine_65.startPoint(), SketchLine_61.startPoint(), "Chamfer/2") SketchConstraintDistanceVertical_8 = Sketch_5.setVerticalDistance(SketchLine_61.startPoint(), SketchLine_63.endPoint(), "Chamfer*1.5") -model.do() RevolutionCut_2.setNestedSketch(Sketch_5) +model.do() # check Sketch_5 model.checkSketch(Sketch_5, 0) # check RevolutionCut_2 @@ -437,7 +437,7 @@ model.testNbSubShapes(Result, GeomAPI_Shape.EDGE, [366]) model.testNbSubShapes(Result, GeomAPI_Shape.VERTEX, [732]) model.testResultsVolumes(Result, [14144.443128843522572424262762070]) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Plug/Modified_Face_3_1"), model.selection("FACE", "Plug/Modified_Face_5_1"), model.selection("FACE", "Plug/Modified_Face_46_1"), model.selection("FACE", "Plug/Modified_Face_48_1")]) +Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Plug/Modified_Face_27_1"), model.selection("FACE", "Plug/Modified_Face_26_1"), model.selection("FACE", "Plug/Modified_Face_28_1"), model.selection("FACE", "Plug/Modified_Face_32_1")]) Group_1.result().setColor(68, 68, 68) # check Group_1 model.checkGroup(Group_1, GeomAPI_Shape.FACE)