Salome HOME
updated copyright message
[modules/shaper.git] / test.API / SHAPER / Transformations / TestAPI_MultiRotation.py
1 # Copyright (C) 2014-2023  CEA, EDF
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_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction
23
24 # Create Boxes
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
33 # Points
34 pntOrigin = pnt(0.,0.,0.)
35 pnt1 = pnt(10.,0.,0.)
36
37 # Axis
38 xDir = direction(10., 0., 0.)
39 ax1 = axis(pntOrigin, xDir)
40
41 # Create MultiRotations
42 MultiRotation_1 = shaperpy.makeMultiRotation(Box_1, ax1, 45., 5)
43 MultiRotation_2 = shaperpy.makeMultiRotation(Box_2, ax1, 0., 5)
44
45 try:
46   MultiRotation_3 = shaperpy.makeMultiRotation(Box_3, ax1, 45., -5)
47 except myExcept as ec:
48   assert(ec.what() == "Multirotation builder :: the number of copies is null or negative.")
49
50 try:
51   MultiRotation_4 = shaperpy.makeMultiRotation(None, ax1, 45., 5)
52 except myExcept as ec:
53   assert(ec.what() == "Transformation :: incorrect input data.")
54
55 try:
56   MultiRotation_5 = shaperpy.makeMultiRotation(Box_4, None, 45., 5)
57 except myExcept as ec:
58   assert(ec.what() == "Multirotation builder :: the axis is not valid")
59
60 MultiRotation_6 = shaperpy.makeMultiRotation(Box_5, ax1, 5)
61
62 try:
63   MultiRotation_7 = shaperpy.makeMultiRotation(Box_6, ax1, -5)
64 except myExcept as ec:
65   assert(ec.what() == "Multirotation builder :: the number of copies is null or negative.")
66
67 try:
68   MultiRotation_8 = shaperpy.makeMultiRotation(None, ax1, 5)
69 except myExcept as ec:
70   assert(ec.what() == "Transformation :: incorrect input data.")
71
72 try:
73   MultiRotation_9 = shaperpy.makeMultiRotation(Box_7, None, 5)
74 except myExcept as ec:
75   assert(ec.what() == "Multirotation builder :: the axis is not valid")