Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / test.API / SHAPER / Transformations / TestAPI_Scale.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 # Create Boxes
26 Box_1 = shaperpy.makeBox(10.,10.,10.)
27 Box_2 = shaperpy.makeBox(10.,10.,10.)
28 Box_3 = shaperpy.makeBox(10.,10.,10.)
29 Box_4 = shaperpy.makeBox(10.,10.,10.)
30 Box_5 = shaperpy.makeBox(10.,10.,10.)
31 Box_6 = shaperpy.makeBox(10.,10.,10.)
32 Box_7 = shaperpy.makeBox(10.,10.,10.)
33 Box_8 = shaperpy.makeBox(10.,10.,10.)
34 Box_9 = shaperpy.makeBox(10.,10.,10.)
35 Box_10 = shaperpy.makeBox(10.,10.,10.)
36 Box_11 = shaperpy.makeBox(10.,10.,10.)
37 Box_12 = shaperpy.makeBox(10.,10.,10.)
38
39 # Create Points
40 pntOrigin = pnt(0., 0., 0.)
41 pnt1 = pnt(-10., -10., -10.)
42
43
44 # Create Scales
45 Scale_1 = shaperpy.makeScale(Box_1, pntOrigin, 2.)
46 Scale_2 = shaperpy.makeScale(Box_2, pnt1, 2.)
47 try :
48     Scale_6 = shaperpy.makeScale(Box_3, pntOrigin, 0)
49 except myExcept,ec :
50     assert(ec.what() == "Scale builder :: the scale factor is null.")
51
52 Scale_7 = shaperpy.makeScale(Box_4, pntOrigin, -3.)
53
54 try :
55     Scale_8 = shaperpy.makeScale(Box_5, None, 2.)
56 except myExcept,ec :
57     assert(ec.what() == "Scale builder :: center point is not valid.")
58
59 Scale_9 = shaperpy.makeScale(Box_6, pntOrigin, 2., 3., 1.)
60 Scale_10 = shaperpy.makeScale(Box_7, pnt1, 2., 3., 1.)
61
62 try :
63     Scale_14 = shaperpy.makeScale(Box_8, pntOrigin, 0., 3., 1.)
64 except myExcept,ec :
65     assert(ec.what() == "Scale builder :: the scale factor in X is null.")
66 try :
67     Scale_15 = shaperpy.makeScale(Box_9, pntOrigin, 2., 0., 1.)
68 except myExcept,ec :
69     assert(ec.what() == "Scale builder :: the scale factor in Y is null.")
70 try :
71     Scale_16 = shaperpy.makeScale(Box_10, pntOrigin, 2., 3., 0.)
72 except myExcept,ec :
73     assert(ec.what() == "Scale builder :: the scale factor in Z is null.")
74
75 Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2., -3., 0.5)
76
77 try :
78     Scale_18 = shaperpy.makeScale(Box_12, None, 2., 3., 1.)
79 except myExcept,ec :
80     assert(ec.what() == "Scale builder :: center point is not valid.")