]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2711: Crash when calling split
authorazv <azv@opencascade.com>
Thu, 18 Oct 2018 06:44:11 +0000 (09:44 +0300)
committerazv <azv@opencascade.com>
Thu, 18 Oct 2018 06:45:23 +0000 (09:45 +0300)
Clear parameters of the Distance constraint when updating.

src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/Test/Test2711.py [new file with mode: 0644]
src/SketchSolver/SketchSolver_ConstraintDistance.cpp

index bbfd660de83c015214a34f5455a370681f2cecc6..bf4ffcb7652f21a5c91cf01f11a722b139f95558 100644 (file)
@@ -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 (file)
index 0000000..e0aa593
--- /dev/null
@@ -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<mailto: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())
index 940ecff5c9796bd6835afddcd9a8e938a058981c..44daa41fa087f4bc2ca6f908497ea2bdb69a7be5 100644 (file)
@@ -171,4 +171,6 @@ void SketchSolver_ConstraintDistance::removeConstraintsKeepingSign()
   aGCSConstraints.pop_back();
   aConstraint->setConstraints(aGCSConstraints);
   aStorage->addConstraint(myBaseConstraint, aConstraint);
+
+  myIsSigned = false;
 }