Salome HOME
7b9d4b6a8cbf8a1175e2b750fa038803aa970dc8
[modules/shaper.git] / src / SketchPlugin / Test / Test2280.py
1 # Copyright (C) 2014-2021  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 """
21     Test2280.py
22     Test case for issue #2280 "Trim in the sketch generates a SIGSEGV"
23 """
24
25 from salome.shaper import model
26 from GeomAPI import GeomAPI_Pnt2d
27
28 model.begin()
29 partSet = model.moduleDocument()
30 Part_1 = model.addPart(partSet)
31 Part_1_doc = Part_1.document()
32 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
33 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2"))
34 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True)
35 SketchCircle_1 = SketchProjection_1.createdFeature()
36 SketchCircle_2 = Sketch_1.addCircle(0.0, 10.0, 8.0)
37 model.do()
38
39 assert(Sketch_1.feature().error() == "")
40 assert(Sketch_1.solverError().value() == "")
41 model.testNbSubFeatures(Sketch_1, "SketchArc", 0)
42 model.testNbSubFeatures(Sketch_1, "SketchCircle", 2)
43
44 # Trim sircle
45 SketchTrim_1 = Sketch_1.addTrim(SketchCircle_2, GeomAPI_Pnt2d(0.0, 18.0))
46 model.do()
47
48 assert(Sketch_1.feature().error() == "")
49 assert(Sketch_1.solverError().value() == "")
50 model.testNbSubFeatures(Sketch_1, "SketchArc", 1)
51 model.testNbSubFeatures(Sketch_1, "SketchCircle", 1)
52
53 model.end()