Salome HOME
fde6fef284291a73332b94f4fea20d7c509ba248
[modules/shaper.git] / test.API / SHAPER / GDML / TestAPI_ConeSegment.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 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
22 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
23 from GeomAPI import GeomAPI_Pnt as pnt
24
25 CS1 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,0.,270.)
26 CS2 = shaperpy.makeConeSegment(5.,10.,7.,15.,15.,45.,180.)
27 CS3 = shaperpy.makeConeSegment(5.,10.,7.,15.,15.,-45.,180.)
28 CS4 = shaperpy.makeConeSegment(0.,10.,2.,7.,3.,0.,270.)
29 CS5 = shaperpy.makeConeSegment(5.,8.,0.,6.,10.,45.,270.)
30 CS6 = shaperpy.makeConeSegment(0.,6.,0.,4.,17.,0.,270.)
31 CS7 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,0.,360.)
32
33 try :
34     CS8 = shaperpy.makeConeSegment(-5.,11.,5.,8.,12.,0.,270.)
35 except myExcept,ec:
36     assert(ec.what() == "Cone Segment builder :: rmin1 is negative.")
37
38 try :
39     CS9 = shaperpy.makeConeSegment(11.,7.,5.,8.,12.,0.,270.)
40 except myExcept,ec:
41     assert(ec.what() == "Cone Segment builder :: rmin1 is larger than rmax1.")
42
43 try :
44     CS10 = shaperpy.makeConeSegment(7.,11.,8.,5.,12.,0.,270.)
45 except myExcept,ec:
46     assert(ec.what() == "Cone Segment builder :: rmin2 is larger than rmax2.")
47
48 try :
49     CS11 = shaperpy.makeConeSegment(7.,11.,-3.,5.,12.,0.,270.)
50 except myExcept,ec:
51     assert(ec.what() == "Cone Segment builder :: rmin2 is negative.")
52
53 try :
54     CS12 = shaperpy.makeConeSegment(7.,11.,5.,8.,0.,0.,270.)
55 except myExcept,ec:
56     assert(ec.what() == "Cone Segment builder :: z is negative or null.")
57
58 try :
59     CS13 = shaperpy.makeConeSegment(7.,11.,5.,8.,-10.,0.,270.)
60 except myExcept,ec:
61     assert(ec.what() == "Cone Segment builder :: z is negative or null.")
62
63 try :
64     CS14 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,-45.,-45.)
65 except myExcept,ec:
66     assert(ec.what() == "Cone Segment builder :: deltaphi is negative or null.")
67
68 try :
69     CS15 = shaperpy.makeConeSegment(7.,11.,5.,8.,12.,45.,450.)
70 except myExcept,ec:
71     assert(ec.what() == "Cone Segment builder :: deltaphi is larger than 360 degree.")