]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2280: Trim in the sketch generates a SIGSEGV
authorazv <azv@opencascade.com>
Tue, 24 Oct 2017 09:40:16 +0000 (12:40 +0300)
committerazv <azv@opencascade.com>
Tue, 24 Oct 2017 09:40:28 +0000 (12:40 +0300)
Avoid setting constraints onto the Projection feature while trimming.

src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_Trim.cpp
src/SketchPlugin/Test/Test2280.py [new file with mode: 0644]

index 1fb666420b538d8451e902480832d87571e5b610..4b4c0b15c54f67feaafcf83f62a99e9f6a073d27 100644 (file)
@@ -222,6 +222,7 @@ ADD_UNIT_TESTS(TestSketchPointLine.py
                TestSignedDistancePointPoint.py
                TestSignedDistancePointLine.py
                Test2273.py
+               Test2280.py
 )
 
 if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE})
index d67e97c8ce5aeac1bc27bae68b278936df555a24..aedc763322e4c4969e9a362fe366714debcf09d9 100644 (file)
@@ -54,6 +54,7 @@
 #include <SketchPlugin_MultiRotation.h>
 #include <SketchPlugin_MultiTranslation.h>
 #include <SketchPlugin_Point.h>
+#include <SketchPlugin_Projection.h>
 
 #include <ModelAPI_EventReentrantMessage.h>
 
@@ -1416,7 +1417,7 @@ void SketchPlugin_Trim::fillObjectShapes(const ObjectPtr& theObject,
                          std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theSketch);
     for (int i = 0; i < aSketchComposite->numberOfSubs(); i++) {
       FeaturePtr aFeature = aSketchComposite->subFeature(i);
-      if (aFeature.get())
+      if (aFeature.get() && aFeature->getKind() != SketchPlugin_Projection::ID())
         aFeatures.push_back(aFeature);
     }
     ModelGeomAlgo_Point2D::getPointsIntersectedShape(aFeature, aFeatures, aPointsInfo);
diff --git a/src/SketchPlugin/Test/Test2280.py b/src/SketchPlugin/Test/Test2280.py
new file mode 100644 (file)
index 0000000..d96bf8a
--- /dev/null
@@ -0,0 +1,54 @@
+## Copyright (C) 2014-2017  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>
+##
+
+"""
+    Test2280.py
+    Test case for issue #2280 "Trim in the sketch generates a SIGSEGV"
+"""
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Pnt2d
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True)
+SketchCircle_1 = SketchProjection_1.createdFeature()
+SketchCircle_2 = Sketch_1.addCircle(0.0, 10.0, 8.0)
+model.do()
+
+assert(Sketch_1.feature().error() == "")
+assert(Sketch_1.solverError().value() == "")
+model.testNbSubFeatures(Sketch_1, "SketchArc", 0)
+model.testNbSubFeatures(Sketch_1, "SketchCircle", 2)
+
+# Trim sircle
+SketchTrim_1 = Sketch_1.addTrim(SketchCircle_2, GeomAPI_Pnt2d(0.0, 18.0))
+model.do()
+
+assert(Sketch_1.feature().error() == "")
+assert(Sketch_1.solverError().value() == "")
+model.testNbSubFeatures(Sketch_1, "SketchArc", 1)
+model.testNbSubFeatures(Sketch_1, "SketchCircle", 1)
+
+model.end()