Salome HOME
Add tests.
[modules/shaper.git] / test.API / SHAPER / Transformations / TestAPI_Scale.py
1 # Copyright (C) 2014-201x CEA/DEN, EDF R&D
2
3 # File:        TestAPI_Scale.py
4 # Created:     25 Jan 2017
5 # Author:      Clarisse Genrault (CEA)
6
7 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
8 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
9 from GeomAPI import GeomAPI_Pnt as pnt
10
11 # Create Boxes
12 Box_1 = shaperpy.makeBox(10.,10.,10.)
13 Box_2 = shaperpy.makeBox(10.,10.,10.)
14 Box_3 = shaperpy.makeBox(10.,10.,10.)
15 Box_4 = shaperpy.makeBox(10.,10.,10.)
16 Box_5 = shaperpy.makeBox(10.,10.,10.)
17 Box_6 = shaperpy.makeBox(10.,10.,10.)
18 Box_7 = shaperpy.makeBox(10.,10.,10.)
19 Box_8 = shaperpy.makeBox(10.,10.,10.)
20 Box_9 = shaperpy.makeBox(10.,10.,10.)
21 Box_10 = shaperpy.makeBox(10.,10.,10.)
22 Box_11 = shaperpy.makeBox(10.,10.,10.)
23 Box_12 = shaperpy.makeBox(10.,10.,10.)
24
25 # Create Points
26 pntOrigin = pnt(0., 0., 0.)
27 pnt1 = pnt(-10., -10., -10.)
28
29
30 # Create Scales
31 Scale_1 = shaperpy.makeScale(Box_1, pntOrigin, 2.)
32 Scale_2 = shaperpy.makeScale(Box_2, pnt1, 2.)
33 try :
34     Scale_6 = shaperpy.makeScale(Box_3, pntOrigin, 0)
35 except myExcept,ec :
36     assert(ec.what() == "Scale builder :: the scale factor is null.")
37
38 Scale_7 = shaperpy.makeScale(Box_4, pntOrigin, -3.)
39
40 try :
41     Scale_8 = shaperpy.makeScale(Box_5, None, 2.)
42 except myExcept,ec :
43     assert(ec.what() == "Scale builder :: center point is not valid.")
44
45 Scale_9 = shaperpy.makeScale(Box_6, pntOrigin, 2., 3., 1.)
46 Scale_10 = shaperpy.makeScale(Box_7, pnt1, 2., 3., 1.)
47
48 try :
49     Scale_14 = shaperpy.makeScale(Box_8, pntOrigin, 0., 3., 1.)
50 except myExcept,ec :
51     assert(ec.what() == "Scale builder :: the scale factor in X is null.")
52 try :
53     Scale_15 = shaperpy.makeScale(Box_9, pntOrigin, 2., 0., 1.)
54 except myExcept,ec :
55     assert(ec.what() == "Scale builder :: the scale factor in Y is null.")
56 try :
57     Scale_16 = shaperpy.makeScale(Box_10, pntOrigin, 2., 3., 0.)
58 except myExcept,ec :
59     assert(ec.what() == "Scale builder :: the scale factor in Z is null.")
60
61 Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2., -3., 0.5)
62
63 try :
64     Scale_18 = shaperpy.makeScale(Box_12, None, 2., 3., 1.)
65 except myExcept,ec :
66     assert(ec.what() == "Scale builder :: center point is not valid.")