Salome HOME
Merge remote-tracking branch 'origin/Dev_PluginPathExtension'
[modules/shaper.git] / src / SketchPlugin / Test / Test2280.py
1 ## Copyright (C) 2014-2017  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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 """
22     Test2280.py
23     Test case for issue #2280 "Trim in the sketch generates a SIGSEGV"
24 """
25
26 from salome.shaper import model
27 from GeomAPI import GeomAPI_Pnt2d
28
29 model.begin()
30 partSet = model.moduleDocument()
31 Part_1 = model.addPart(partSet)
32 Part_1_doc = Part_1.document()
33 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
34 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2"))
35 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True)
36 SketchCircle_1 = SketchProjection_1.createdFeature()
37 SketchCircle_2 = Sketch_1.addCircle(0.0, 10.0, 8.0)
38 model.do()
39
40 assert(Sketch_1.feature().error() == "")
41 assert(Sketch_1.solverError().value() == "")
42 model.testNbSubFeatures(Sketch_1, "SketchArc", 0)
43 model.testNbSubFeatures(Sketch_1, "SketchCircle", 2)
44
45 # Trim sircle
46 SketchTrim_1 = Sketch_1.addTrim(SketchCircle_2, GeomAPI_Pnt2d(0.0, 18.0))
47 model.do()
48
49 assert(Sketch_1.feature().error() == "")
50 assert(Sketch_1.solverError().value() == "")
51 model.testNbSubFeatures(Sketch_1, "SketchArc", 1)
52 model.testNbSubFeatures(Sketch_1, "SketchCircle", 1)
53
54 model.end()