1 # Copyright (C) 2014-2021 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
21 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
22 from GeomAPI import GeomAPI_Pnt as pnt, GeomAPI_Shape as shape
25 Box_1 = shaperpy.makeBox(10.,10.,10.)
26 Box_2 = shaperpy.makeBox(10.,10.,10.)
27 Box_3 = shaperpy.makeBox(10.,10.,10.)
28 Box_4 = shaperpy.makeBox(10.,10.,10.)
29 Box_5 = shaperpy.makeBox(10.,10.,10.)
30 Box_6 = shaperpy.makeBox(10.,10.,10.)
31 Box_7 = shaperpy.makeBox(10.,10.,10.)
32 Box_8 = shaperpy.makeBox(10.,10.,10.)
33 Box_9 = shaperpy.makeBox(10.,10.,10.)
34 Box_10 = shaperpy.makeBox(10.,10.,10.)
35 Box_11 = shaperpy.makeBox(10.,10.,10.)
36 Box_12 = shaperpy.makeBox(10.,10.,10.)
39 pntOrigin = pnt(0., 0., 0.)
40 pnt1 = pnt(-10., -10., -10.)
44 Scale_1 = shaperpy.makeScale(Box_1, pntOrigin, 2.)
45 Scale_2 = shaperpy.makeScale(Box_2, pnt1, 2.)
47 Scale_6 = shaperpy.makeScale(Box_3, pntOrigin, 0)
48 except myExcept as ec :
49 assert(ec.what() == "Scale builder :: the scale factor is null.")
51 Scale_7 = shaperpy.makeScale(Box_4, pntOrigin, -3.)
54 Scale_8 = shaperpy.makeScale(Box_5, None, 2.)
55 except myExcept as ec :
56 assert(ec.what() == "Scale builder :: center point is not valid.")
58 Scale_9 = shaperpy.makeScale(Box_6, pntOrigin, 2., 3., 1.)
59 Scale_10 = shaperpy.makeScale(Box_7, pnt1, 2., 3., 1.)
62 Scale_14 = shaperpy.makeScale(Box_8, pntOrigin, 0., 3., 1.)
63 except myExcept as ec :
64 assert(ec.what() == "Scale builder :: the scale factor in X is null.")
66 Scale_15 = shaperpy.makeScale(Box_9, pntOrigin, 2., 0., 1.)
67 except myExcept as ec :
68 assert(ec.what() == "Scale builder :: the scale factor in Y is null.")
70 Scale_16 = shaperpy.makeScale(Box_10, pntOrigin, 2., 3., 0.)
71 except myExcept as ec :
72 assert(ec.what() == "Scale builder :: the scale factor in Z is null.")
74 Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2., -3., 0.5)
77 Scale_18 = shaperpy.makeScale(Box_12, None, 2., 3., 1.)
78 except myExcept as ec :
79 assert(ec.what() == "Scale builder :: center point is not valid.")
82 Scale_19 = shaperpy.makeScale(None, pntOrigin, 2., 3., 1.)
83 except myExcept as ec :
84 assert(ec.what() == "Scale builder :: source shape is not valid.")
87 Scale_20 = shaperpy.makeScale(shape(), pntOrigin, 2.)
88 except myExcept as ec :
89 assert(ec.what() == "Transformation :: source shape does not contain any actual shape.")
92 Scale_21 = shaperpy.makeScale(shape(), pntOrigin, 2., 3., 1.)
93 except myExcept as ec :
94 assert(ec.what() == "Scale builder :: source shape does not contain any actual shape.")