]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2616: Improve searching of conflicting constraints
authorazv <azv@opencascade.com>
Fri, 7 Sep 2018 12:10:11 +0000 (15:10 +0300)
committerazv <azv@opencascade.com>
Fri, 14 Sep 2018 08:54:24 +0000 (11:54 +0300)
Implement setting for each PlaneGCS constraint unique tag if SketchPlugin constraint consists of several PlaneGCS constraints.

12 files changed:
src/ExchangePlugin/Test/Test2459.py
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/Test/Test1963.py [new file with mode: 0644]
src/SketchPlugin/Test/Test2034_1.py [new file with mode: 0644]
src/SketchPlugin/Test/Test2034_2.py [new file with mode: 0644]
src/SketchPlugin/Test/Test2034_3.py [new file with mode: 0644]
src/SketchPlugin/Test/Test2134.py [new file with mode: 0644]
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.cpp
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp
test.models/ecran.py

index 6f8fe991133c2fbb082fc64a3d72b597494c4d79..9cd57811e0372a40026adfbfb8fae57ccc382420 100644 (file)
@@ -101,10 +101,9 @@ SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_1.center(), Sketc
 SketchArc_14 = Sketch_1.addArc(0, 0, -17.49809851618825, 0.2579696062919513, -8.525641025641027, -15.2827826360878, False)
 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_14.endPoint())
 SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_14.results()[1])
-SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_14.center())
+SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_14.results()[1])
 SketchArc_15 = Sketch_1.addArc(0, 0, 8.97245749054723, 15.02481302979584, -8.972457490547235, 15.02481302979584, False)
-SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_15.results()[1])
-SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.center(), SketchArc_15.center())
+SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_3.results()[1], SketchArc_15.results()[1])
 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchAPI_Arc(SketchArc_13).startPoint(), SketchArc_14.startPoint())
 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchAPI_Arc(SketchArc_7).endPoint())
 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_15.startPoint(), SketchAPI_Arc(SketchArc_12).startPoint())
index a5c8ecdba7471b2f90cb7b134afba034f41658be..bb21061611e7b26a8a61919c9fee36cb65ddb385 100644 (file)
@@ -248,6 +248,11 @@ ADD_UNIT_TESTS(TestSketchPointLine.py
                Test2157.py
                Test2157_2.py
                Test2481.py
+               Test1963.py
+               Test2034_1.py
+               Test2034_2.py
+               Test2034_3.py
+               Test2134.py
 )
 
 if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE})
diff --git a/src/SketchPlugin/Test/Test1963.py b/src/SketchPlugin/Test/Test1963.py
new file mode 100644 (file)
index 0000000..261e8c5
--- /dev/null
@@ -0,0 +1,125 @@
+## 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>
+##
+
+"""
+    Test1963.py
+    Test case for issue #1963 "Conflicting constraint wrongly raised"
+"""
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(6.188, 9.263, 6.188, -3.45)
+SketchLine_2 = Sketch_1.addLine(6.188, -3.45, 0, -3.45)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(0, -3.45, 0, -6.45)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(0, -6.45, 10.31630157312683, -6.45)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(10.31630157312683, -6.45, 10.31630157312683, -3.45)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(10.31630157312683, -3.45, 6.538, -3.45)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_2.result())
+SketchLine_7 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OZ"))
+SketchLine_7.setName("SketchLine_8")
+SketchLine_7.result().setName("SketchLine_8")
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_7.result())
+SketchLine_8 = Sketch_1.addLine(6.188, 9.263, 6.376, 9.263)
+SketchLine_8.setName("SketchLine_9")
+SketchLine_8.result().setName("SketchLine_9")
+SketchLine_8.setAuxiliary(True)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_1.result(), 6.188)
+SketchLine_9 = Sketch_1.addLine(6.376, 9.263, 6.376, -2.284019283906062)
+SketchLine_9.setName("SketchLine_10")
+SketchLine_9.result().setName("SketchLine_10")
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchLine_10 = Sketch_1.addLine(6.376, -2.284019283906062, 6.538, -2.359739840005481)
+SketchLine_10.setName("SketchLine_11")
+SketchLine_10.result().setName("SketchLine_11")
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchLine_11 = Sketch_1.addLine(6.538, -2.359739840005481, 6.538, -3.45)
+SketchLine_11.setName("SketchLine_12")
+SketchLine_11.result().setName("SketchLine_12")
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_11.endPoint())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_9.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_11.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_9.result(), 0.188)
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_1.result(), SketchLine_11.endPoint(), 0.35)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 3)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_2.result(), 3.45)
+SketchLine_12 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX"))
+SketchLine_12.setName("SketchLine_13")
+SketchLine_12.result().setName("SketchLine_13")
+SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_12.result(), 9.263)
+SketchLine_13 = Sketch_1.addLine(7.131011037651645, -4.08833050970321, 5.469691015801997, -4.08833050970321)
+SketchLine_13.setName("SketchLine_14")
+SketchLine_13.result().setName("SketchLine_14")
+SketchLine_14 = Sketch_1.addLine(5.469691015801997, -4.08833050970321, 5.469691015801997, -5.799435189085778)
+SketchLine_14.setName("SketchLine_15")
+SketchLine_14.result().setName("SketchLine_15")
+SketchLine_15 = Sketch_1.addLine(5.469691015801997, -5.799435189085778, 7.131011037651645, -5.799435189085778)
+SketchLine_15.setName("SketchLine_16")
+SketchLine_15.result().setName("SketchLine_16")
+SketchLine_16 = Sketch_1.addLine(7.131011037651645, -5.799435189085778, 7.131011037651645, -4.08833050970321)
+SketchLine_16.setName("SketchLine_17")
+SketchLine_16.result().setName("SketchLine_17")
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_13.result())
+SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_14.result())
+SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_15.result())
+SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_16.result())
+SketchLine_17 = Sketch_1.addLine(6.282, 9.263, 6.282, -4.088330509703209)
+SketchLine_17.setName("SketchLine_18")
+SketchLine_17.result().setName("SketchLine_18")
+SketchLine_17.setAuxiliary(True)
+SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_17.startPoint(), SketchLine_8.result())
+SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_13.result())
+SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_17.result())
+SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_17.startPoint(), SketchLine_8.result())
+model.do()
+
+# check sketch is correct
+assert(Sketch_1.solverError().value() == "")
+
+SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_17.endPoint(), SketchLine_13.result())
+SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_17.endPoint(), SketchLine_5.result(), 1.5, True)
+model.do()
+
+# check sketch is still correct
+assert(Sketch_1.solverError().value() == "")
+
+model.end()
diff --git a/src/SketchPlugin/Test/Test2034_1.py b/src/SketchPlugin/Test/Test2034_1.py
new file mode 100644 (file)
index 0000000..7b55c98
--- /dev/null
@@ -0,0 +1,55 @@
+## 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>
+##
+
+"""
+    Test2034_1.py
+    Test case for issue #2034 "Conflicting constraint not raised (but found by planegcs and shaper's dof computation)"
+"""
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, 30, 30, 0)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OY"), False)
+SketchLine_2 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False)
+SketchLine_3 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_1.endPoint(), 30, True)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_1.startPoint(), 30, True)
+SketchArc_1 = Sketch_1.addArc(-1.010399194398717, -1.010399194382958, 0, 30, 30, 0, False)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.endPoint())
+model.do()
+
+# check sketch is correct
+assert(Sketch_1.solverError().value() == "")
+
+# add coincidence between center of arc and an origin
+Sketch_1.setCoincident(SketchArc_1.center(), SketchAPI_Line(SketchLine_2).startPoint())
+model.do()
+assert(Sketch_1.solverError().value() != "")
+
+model.end()
diff --git a/src/SketchPlugin/Test/Test2034_2.py b/src/SketchPlugin/Test/Test2034_2.py
new file mode 100644 (file)
index 0000000..41a1b2e
--- /dev/null
@@ -0,0 +1,52 @@
+## 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>
+##
+
+"""
+    Test2034_2.py
+    Test case for issue #2034 "Conflicting constraint not raised (but found by planegcs and shaper's dof computation)"
+"""
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(2.537917624456907, 8.497392663945117, 15)
+SketchLine_1 = Sketch_1.addLine(-12.22290362866818, 11.16537990805196, 2.537924341198721, 8.497429825311462)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+SketchLine_2 = Sketch_1.addLine(2.537924341198721, 8.497429825311462, 17.29875231106562, 5.829479742570965)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
+SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_2.result())
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 15)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 15)
+model.do()
+
+# check sketch is correct
+assert(Sketch_1.solverError().value() == "")
+
+# add coincidence between center of circle and the end point of line
+Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.endPoint())
+model.do()
+assert(Sketch_1.solverError().value() != "")
+
+
+model.end()
diff --git a/src/SketchPlugin/Test/Test2034_3.py b/src/SketchPlugin/Test/Test2034_3.py
new file mode 100644 (file)
index 0000000..632db03
--- /dev/null
@@ -0,0 +1,70 @@
+## 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>
+##
+
+"""
+    Test2034_3.py
+    Test case for issue #2034 "Conflicting constraint not raised (but found by planegcs and shaper's dof computation)"
+"""
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(5, 0, 0, 5)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False)
+SketchLine_2 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OZ"), False)
+SketchLine_3 = SketchProjection_2.createdFeature()
+SketchLine_4 = Sketch_1.addLine(0, 5, -5, 0)
+SketchLine_5 = Sketch_1.addLine(-5, 0, 5, 0)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_2.result())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint())
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.result())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint())
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 10)
+model.do()
+Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), False)
+SketchPoint_1 = SketchProjection_3.createdFeature()
+SketchArc_1 = Sketch_2.addArc(0, 5, -5, 0, 5, 0, False)
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_1.startPoint())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_5e"), False)
+SketchPoint_2 = SketchProjection_4.createdFeature()
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates())
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_1e"), False)
+SketchPoint_3 = SketchProjection_5.createdFeature()
+model.do()
+
+# check sketch is correct
+assert(Sketch_2.solverError().value() == "")
+
+# add coincidence between center of arc and a point from the first sketch
+Sketch_2.setCoincident(SketchArc_1.center(), SketchAPI_Point(SketchPoint_3).coordinates())
+model.do()
+assert(Sketch_2.solverError().value() != "")
+
+model.end()
diff --git a/src/SketchPlugin/Test/Test2134.py b/src/SketchPlugin/Test/Test2134.py
new file mode 100644 (file)
index 0000000..a1f6604
--- /dev/null
@@ -0,0 +1,188 @@
+## 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>
+##
+
+"""
+    Test2134.py
+    Test case for issue #2134 "Conflicting constraint not shown in the viewer"
+"""
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(6.188, 9.025, 6.188, -3.45)
+SketchLine_2 = Sketch_1.addLine(6.188, -3.45, 0, -3.45)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(0, -3.45, 0, -6.45)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(0, -6.45, 7.782000000000002, -6.45)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(7.781999999999998, -6.45, 7.782, -3.45)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(7.782000000000002, -3.45, 6.538000000000001, -3.45)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchLine_7 = Sketch_1.addLine(6.538000000000001, -3.45, 6.538, -2.4)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchLine_8 = Sketch_1.addLine(6.538000000000002, -2.4, 6.375999999999999, -2.25)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchLine_9 = Sketch_1.addLine(6.375999999999999, -2.25, 6.375999999999999, 9.025)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_9.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_1.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_6.result())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_7.result())
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchLine_2.result())
+SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "OZ"))
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_10.result())
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_10.result())
+SketchLine_11 = Sketch_1.addLine(6.187999999999999, 9.025, 6.375999999999999, 9.025)
+SketchLine_11.setAuxiliary(True)
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_11.endPoint())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_11.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_2.result(), 3.45)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_1.result(), 6.188)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_11.result(), 0.188)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 3)
+SketchLine_12 = Sketch_1.addLine(7.032000000000001, -4.050000000000001, 5.532000000000001, -4.050000000000001)
+SketchLine_13 = Sketch_1.addLine(5.532000000000001, -4.050000000000001, 5.532000000000001, -5.850000000000001)
+SketchLine_14 = Sketch_1.addLine(5.532000000000001, -5.850000000000001, 7.032000000000001, -5.850000000000001)
+SketchLine_15 = Sketch_1.addLine(7.032000000000001, -5.850000000000001, 7.032000000000001, -4.050000000000001)
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
+SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
+SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_12.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_13.result())
+SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_14.result())
+SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_15.result())
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_14.result(), 1.5)
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_13.result(), 1.8)
+SketchLine_16 = Sketch_1.addLine(6.282000000000001, 9.025000000000011, 6.282000000000001, -4.05)
+SketchLine_16.setAuxiliary(True)
+SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_16.startPoint(), SketchLine_11.result())
+SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_12.result())
+SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_16.result())
+SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_12.result(), SketchLine_16.endPoint())
+SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_16.startPoint(), SketchLine_11.result())
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_5.result(), 1.5)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_7.result(), 0.256)
+SketchLine_17 = Sketch_1.addLine(model.selection("EDGE", "OX"))
+SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_17.result(), 9.025)
+SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_17.result(), 2.25)
+SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_17.result(), 2.4)
+SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_12.result(), 0.6)
+SketchLine_18 = Sketch_1.addLine(6.375999999999999, 9.025, 6.537999999999997, 9.186999999999998)
+SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_18.startPoint())
+SketchLine_19 = Sketch_1.addLine(6.538000000000008, 9.187000000000008, 6.537999999999997, 10.256)
+SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
+SketchLine_20 = Sketch_1.addLine(6.537999999999997, 10.256, 6.187999999999997, 10.256)
+SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint())
+SketchLine_21 = Sketch_1.addLine(6.187999999999997, 10.256, 4.93800000000044, 10.97786688777776)
+SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_19.result())
+SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_20.result())
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_20.result(), 0.35)
+SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_16.startPoint(), SketchLine_19.result(), 0.256)
+SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_11.result(), 45)
+SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_19.endPoint(), SketchLine_17.result(), 10.256)
+SketchLine_22 = Sketch_1.addLine(6.188, 9.025, 6.081999999999999, 9.532)
+SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_22.startPoint())
+SketchArc_1 = Sketch_1.addArc(0, 2.425, 4.93800000000044, 10.97786688777776, 0, 12.301, False)
+SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_1.center())
+SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_1.endPoint())
+SketchArc_2 = Sketch_1.addArc(-1.129352735403899e-028, 2.425, 4.856000000000012, 10.83583872155449, 0, 12.137, False)
+SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_2.center())
+SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_2.endPoint())
+SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_2.center())
+SketchLine_23 = Sketch_1.addLine(0, 12.301, 0, 12.137)
+SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_23.startPoint())
+SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_23.endPoint())
+SketchConstraintDistance_11 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_17.result(), 2.425)
+SketchArc_3 = Sketch_1.addArc(1.409050931477502e-030, 2.425, -1.654361225106055e-024, 12.219, 5.756768760952482, 10.34851244290824, True)
+SketchArc_3.setAuxiliary(True)
+SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_3.center())
+SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_23.result(), SketchArc_3.startPoint())
+SketchConstraintMiddle_3 = Sketch_1.setMiddlePoint(SketchLine_23.result(), SketchArc_3.startPoint())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_3.results()[1], 9.794000000000001)
+SketchLine_24 = Sketch_1.addLine(4.856000000000012, 10.83583872155449, 5.1433963786475, 10.65615482129429)
+SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_24.startPoint())
+SketchLine_25 = Sketch_1.addLine(5.1433963786475, 10.65615482129429, 5.417460848824597, 10.45671600291325)
+SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchLine_25.startPoint())
+SketchLine_26 = Sketch_1.addLine(5.417460848824597, 10.45671600291325, 5.676945960870162, 10.23864578403355)
+SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint())
+SketchArc_4 = Sketch_1.addArc(4.79378612024245, 9.263, 6.082, 9.532, 5.676945960870163, 10.23864578403355, False)
+SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchArc_4.startPoint())
+SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_26.endPoint())
+SketchConstraintDistance_12 = Sketch_1.setDistance(SketchArc_4.startPoint(), SketchLine_17.result(), 9.532)
+SketchConstraintDistance_13 = Sketch_1.setDistance(SketchArc_4.startPoint(), SketchLine_1.result(), 0.106)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_4.results()[1], 1.316)
+SketchConstraintDistance_14 = Sketch_1.setDistance(SketchArc_4.center(), SketchLine_17.result(), 9.263)
+SketchLine_27 = Sketch_1.addLine(-1.129352735403899e-028, 2.425, 4.897000000000013, 10.90685280466482)
+SketchLine_27.setAuxiliary(True)
+SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_27.startPoint())
+SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchArc_3.results()[1])
+SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_27.result())
+SketchLine_28 = Sketch_1.addLine(-2.420652665866155e-034, 2.425, 5.190029273900023, 10.73078305375606)
+SketchLine_28.setAuxiliary(True)
+SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_28.startPoint())
+SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchArc_3.results()[1])
+SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_28.result(), SketchLine_24.endPoint())
+SketchLine_29 = Sketch_1.addLine(0, 2.425, 5.476735296592496, 10.54459398560408)
+SketchLine_29.setAuxiliary(True)
+SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_29.startPoint())
+SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchArc_3.results()[1])
+SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_29.result())
+SketchLine_30 = Sketch_1.addLine(-1.129352735403899e-028, 2.425, 5.756768760952482, 10.34851244290824)
+SketchLine_30.setAuxiliary(True)
+SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_30.startPoint())
+SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_30.endPoint())
+SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_30.result())
+SketchConstraintDistance_15 = Sketch_1.setDistance(SketchArc_3.startPoint(), SketchLine_23.endPoint(), 0.082)
+SketchConstraintDistance_16 = Sketch_1.setDistance(SketchLine_24.endPoint(), SketchLine_28.endPoint(), 0.088)
+SketchConstraintDistance_17 = Sketch_1.setDistance(SketchLine_25.endPoint(), SketchLine_29.endPoint(), 0.106)
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_30.result(), SketchLine_10.result(), 36)
+SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_29.result(), SketchLine_10.result(), 34)
+SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_28.result(), SketchLine_10.result(), 32)
+SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_10.result(), 30)
+SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_27.result())
+model.do()
+
+# check sketch is correct
+assert(Sketch_1.solverError().value() == "")
+
+# add coincidence between center of arc and a point from the first sketch
+SketchConstraintDistance_18 = Sketch_1.setDistance(SketchLine_28.endPoint(), SketchLine_21.result(), 0.088, True)
+model.do()
+assert(Sketch_1.solverError().value() != "")
+
+# remove constraint, check sketch is correct now
+partSet.removeFeature(SketchConstraintDistance_18.feature())
+model.do()
+assert(Sketch_1.solverError().value() == "")
+
+model.end()
+
+assert(model.checkPythonDump())
\ No newline at end of file
index 7ce6c094ceb5acbd69523b0c9bcd150dc4bc14a5..4ab3b043d68175e985f2130975ad9be7b101b856 100644 (file)
@@ -41,9 +41,6 @@ PlaneGCSSolver_ConstraintWrapper::PlaneGCSSolver_ConstraintWrapper(
 void PlaneGCSSolver_ConstraintWrapper::setId(const ConstraintID& theID)
 {
   myID = theID;
-  std::list<GCSConstraintPtr>::iterator anIt = myGCSConstraints.begin();
-  for (; anIt != myGCSConstraints.end(); ++anIt)
-    (*anIt)->setTag((int)theID);
 }
 
 void PlaneGCSSolver_ConstraintWrapper::setValueParameter(const ScalarWrapperPtr& theValue)
index 09c18b1f9b958927461f90907053e5c6c32d4b8b..a49487878b7dbc309abfa6a8e21ef17e2513ceb9 100644 (file)
@@ -21,6 +21,9 @@
 #include <PlaneGCSSolver_Solver.h>
 #include <Events_LongOp.h>
 
+// Multiplier to correlate IDs of SketchPlugin constraint and primitive PlaneGCS constraints
+static const int THE_CONSTRAINT_MULT = 10;
+
 
 PlaneGCSSolver_Solver::PlaneGCSSolver_Solver()
   : myEquationSystem(new GCS::System),
@@ -48,26 +51,46 @@ void PlaneGCSSolver_Solver::clear()
   removeFictiveConstraint();
 }
 
-void PlaneGCSSolver_Solver::addConstraint(GCSConstraintPtr theConstraint)
+void PlaneGCSSolver_Solver::addConstraint(const ConstraintID& theMultiConstraintID,
+                                          const std::list<GCSConstraintPtr>& theConstraints)
 {
-  myEquationSystem->addConstraint(theConstraint.get());
-  myConstraints[theConstraint->getTag()].insert(theConstraint);
-  if (theConstraint->getTag() >= 0)
+  int anID = theMultiConstraintID > CID_UNKNOWN ?
+             theMultiConstraintID * THE_CONSTRAINT_MULT :
+             theMultiConstraintID;
+
+  for (std::list<GCSConstraintPtr>::const_iterator anIt = theConstraints.begin();
+       anIt != theConstraints.end(); ++anIt) {
+    GCSConstraintPtr aConstraint = *anIt;
+    aConstraint->setTag(anID);
+    myEquationSystem->addConstraint(aConstraint.get());
+    myConstraints[theMultiConstraintID].insert(aConstraint);
+
+    if (anID > CID_UNKNOWN)
+      ++anID;
+  }
+
+  if (theMultiConstraintID >= CID_UNKNOWN)
     myDOF = -1;
   myInitilized = false;
 }
 
-void PlaneGCSSolver_Solver::removeConstraint(ConstraintID theID)
+void PlaneGCSSolver_Solver::removeConstraint(const ConstraintID& theID)
 {
-  myConstraints.erase(theID);
+  ConstraintMap::iterator aFound = myConstraints.find(theID);
+  if (aFound != myConstraints.end()) {
+    for (std::set<GCSConstraintPtr>::iterator anIt = aFound->second.begin();
+         anIt != aFound->second.end(); ++anIt)
+      myEquationSystem->clearByTag((*anIt)->getTag());
+
+    myConstraints.erase(aFound);
+  }
+
   if (myConstraints.empty()) {
     myEquationSystem->clear();
     myDOF = (int)myParameters.size();
-  } else {
-    myEquationSystem->clearByTag(theID);
-    if (theID >= 0)
-      myDOF = -1;
-  }
+  } else if (theID >= CID_UNKNOWN)
+    myDOF = -1;
+
   myInitilized = false;
 }
 
@@ -206,10 +229,14 @@ void PlaneGCSSolver_Solver::collectConflicting()
 {
   GCS::VEC_I aConflict;
   myEquationSystem->getConflicting(aConflict);
-  myConflictingIDs.insert(aConflict.begin(), aConflict.end());
+  // convert PlaneGCS constraint IDs to SketchPlugin's ID
+  for (GCS::VEC_I::const_iterator anIt = aConflict.begin(); anIt != aConflict.end(); ++anIt)
+    myConflictingIDs.insert((*anIt) / THE_CONSTRAINT_MULT);
 
   myEquationSystem->getRedundant(aConflict);
-  myConflictingIDs.insert(aConflict.begin(), aConflict.end());
+  // convert PlaneGCS constraint IDs to SketchPlugin's ID
+  for (GCS::VEC_I::const_iterator anIt = aConflict.begin(); anIt != aConflict.end(); ++anIt)
+    myConflictingIDs.insert((*anIt) / THE_CONSTRAINT_MULT);
 
   myConfCollected = true;
 }
index 572f2df25ecce3fd5dd38b47e2d6a401c9ebc45f..0b4ba42e650640f3a3f01052fb91182e2fdeaffd 100644 (file)
@@ -46,10 +46,14 @@ public:
   void clear();
 
   /// \brief Add constraint to the system of equations
-  void addConstraint(GCSConstraintPtr theConstraint);
-
-  /// \brief Remove constraint from the system of equations
-  void removeConstraint(ConstraintID theID);
+  /// \param[in] theMultiConstraintID  ID of the multi constraint which may consists of
+  ///                                  several primitive constraints
+  /// \param[in] theConstraints        list of primitive constraints
+  void addConstraint(const ConstraintID& theMultiConstraintID,
+                     const std::list<GCSConstraintPtr>& theConstraints);
+
+  /// \brief Remove constraints from the system of equations
+  void removeConstraint(const ConstraintID& theID);
 
   /// \brief Initialize memory for new solver's parameter
   double* createParameter();
index 830a482fed2eda7b2c61f1bafa6c99d2d6809f12..e02c6993499010e231cf162b0f8217c69122a871 100644 (file)
@@ -44,9 +44,7 @@ static void constraintsToSolver(const ConstraintWrapperPtr& theConstraint,
 {
   const std::list<GCSConstraintPtr>& aConstraints =
       std::dynamic_pointer_cast<PlaneGCSSolver_ConstraintWrapper>(theConstraint)->constraints();
-  std::list<GCSConstraintPtr>::const_iterator anIt = aConstraints.begin();
-  for (; anIt != aConstraints.end(); ++anIt)
-    theSolver->addConstraint(*anIt);
+  theSolver->addConstraint(theConstraint->id(), aConstraints);
 }
 
 
index 726b5099f25cc98eaf227f02717dd535fed9fdde..1a0dc5ac09075c39b010914b4e2f810bf8045d8b 100644 (file)
@@ -977,7 +977,7 @@ SketchConstraintCoincidence_137 = Sketch_8.setCoincident(SketchLine_134.endPoint
 SketchConstraintCoincidence_137.setName("SketchConstraintCoincidence_143")
 SketchConstraintCoincidence_138 = Sketch_8.setCoincident(SketchLine_135.startPoint(), SketchLine_137.endPoint())
 SketchConstraintCoincidence_138.setName("SketchConstraintCoincidence_147")
-SketchConstraintMiddle_2 = Sketch_8.setMiddlePoint(SketchLine_136.result(), SketchArc_61.center())
+SketchConstraintCoincidence_152 = Sketch_8.setCoincident(SketchArc_61.center(), SketchLine_136.result())
 SketchConstraintLength_10 = Sketch_8.setLength(SketchLine_134.result(), 1.7)
 SketchConstraintLength_10.setName("SketchConstraintLength_11")
 SketchConstraintVertical_17 = Sketch_8.setVertical(SketchLine_137.result())
@@ -1018,8 +1018,7 @@ SketchConstraintCoincidence_148 = Sketch_8.setCoincident(SketchLine_138.endPoint
 SketchConstraintCoincidence_148.setName("SketchConstraintCoincidence_158")
 SketchConstraintCoincidence_149 = Sketch_8.setCoincident(SketchArc_62.startPoint(), SketchLine_134.endPoint())
 SketchConstraintCoincidence_149.setName("SketchConstraintCoincidence_159")
-SketchConstraintMiddle_4 = Sketch_8.setMiddlePoint(SketchLine_137.result(), SketchArc_62.center())
-SketchConstraintMiddle_4.setName("SketchConstraintMiddle_5")
+SketchConstraintCoincidence_150 = Sketch_8.setCoincident(SketchArc_62.center(), SketchLine_137.result())
 SketchLine_140 = Sketch_8.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_6_1/Modfied_2"))
 SketchLine_140.setName("SketchLine_145")
 SketchLine_140.result().setName("SketchLine_145")
@@ -1028,8 +1027,8 @@ SketchLine_141 = Sketch_8.addLine(0, 49.1, 107.43, 49.1)
 SketchLine_141.setName("SketchLine_146")
 SketchLine_141.result().setName("SketchLine_146")
 SketchLine_141.setAuxiliary(True)
-SketchConstraintCoincidence_150 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_141.startPoint())
-SketchConstraintCoincidence_150.setName("SketchConstraintCoincidence_160")
+SketchConstraintCoincidence_151 = Sketch_8.setCoincident(SketchPoint_12.coordinates(), SketchLine_141.startPoint())
+
 SketchConstraintHorizontal_22 = Sketch_8.setHorizontal(SketchLine_141.result())
 SketchConstraintLength_11 = Sketch_8.setLength(SketchLine_141.result(), 107.43)
 SketchConstraintLength_11.setName("SketchConstraintLength_12")