From: azv Date: Thu, 18 Oct 2018 06:44:11 +0000 (+0300) Subject: Issue #2711: Crash when calling split X-Git-Tag: V9_2_0a2~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a4fa21f592d01c50f04080d0c877b37710df82e9;p=modules%2Fshaper.git Issue #2711: Crash when calling split Clear parameters of the Distance constraint when updating. --- diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index bbfd660de..bf4ffcb76 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -261,6 +261,7 @@ ADD_UNIT_TESTS(TestSketchPointLine.py Test1578.py Test2654.py Test1779.py + Test2711.py ) if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE}) diff --git a/src/SketchPlugin/Test/Test2711.py b/src/SketchPlugin/Test/Test2711.py new file mode 100644 index 000000000..e0aa593a1 --- /dev/null +++ b/src/SketchPlugin/Test/Test2711.py @@ -0,0 +1,92 @@ +## Copyright (C) 2018-20xx 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 +## + +""" + Test2711.py + Test case for issue #2711 "Crash when calling split" +""" + +from salome.shaper import model +from salome.shaper import geom + +from ModelAPI import * +from SketchAPI import * + +model.begin() +partSet = model.moduleDocument() +Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(-0.4, -0.45, 3.6, -0.45) +SketchLine_2 = Sketch_1.addLine(3.6, -0.45, 3.6, 0.2) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +SketchLine_3 = Sketch_1.addLine(3.6, 0.2, 0.25, 0.2) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(0.25, 0.2, 0.25, 3.55) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_5 = Sketch_1.addLine(0.25, 3.55, -0.4, 3.55) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchLine_6 = Sketch_1.addLine(-0.4, 3.55, -0.4, -0.45) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_6.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) +SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_2.result()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) +SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 0.65) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 0.65) +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_6.result(), 4) +SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_1.result(), 4) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False) +SketchLine_7 = SketchProjection_1.createdFeature() +SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_6.startPoint(), SketchLine_7.result(), 0.4, True) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False) +SketchLine_8 = SketchProjection_2.createdFeature() +SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_8.result(), 0.2, True) +model.do() + +model.checkSketch(Sketch_1, 0) + +SketchPoint_1 = Sketch_1.addPoint(2, 0.2) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_3.result()) +model.do() + +model.checkSketch(Sketch_1, 1) + +Sketch_1.addSplit(SketchLine_3, geom.Pnt2d(3, 0.2)) +model.do() + +model.checkSketch(Sketch_1, 2) + +SketchLine_9 = SketchAPI_Line(model.lastSubFeature(featureToCompositeFeature(Sketch_1.feature()), "SketchLine")) +SketchPoint_2 = Sketch_1.addPoint(3, 0.2) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_9.result()) +model.do() + +model.checkSketch(Sketch_1, 3) + +Sketch_1.addSplit(SketchLine_9, geom.Pnt2d(3.2, 0.2)) +model.do() + +model.checkSketch(Sketch_1, 4) + +model.end() + +assert(model.checkPythonDump()) diff --git a/src/SketchSolver/SketchSolver_ConstraintDistance.cpp b/src/SketchSolver/SketchSolver_ConstraintDistance.cpp index 940ecff5c..44daa41fa 100644 --- a/src/SketchSolver/SketchSolver_ConstraintDistance.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintDistance.cpp @@ -171,4 +171,6 @@ void SketchSolver_ConstraintDistance::removeConstraintsKeepingSign() aGCSConstraints.pop_back(); aConstraint->setConstraints(aGCSConstraints); aStorage->addConstraint(myBaseConstraint, aConstraint); + + myIsSigned = false; }