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