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_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction
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.)
34 pntOrigin = pnt(0.,0.,0.)
38 xDir = direction(10., 0., 0.)
39 ax1 = axis(pntOrigin, xDir)
41 # Create MultiRotations
42 MultiRotation_1 = shaperpy.makeMultiRotation(Box_1, ax1, 45., 5)
43 MultiRotation_2 = shaperpy.makeMultiRotation(Box_2, ax1, 0., 5)
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.")
51 MultiRotation_4 = shaperpy.makeMultiRotation(None, ax1, 45., 5)
52 except myExcept as ec:
53 assert(ec.what() == "Transformation :: incorrect input data.")
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")
60 MultiRotation_6 = shaperpy.makeMultiRotation(Box_5, ax1, 5)
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.")
68 MultiRotation_8 = shaperpy.makeMultiRotation(None, ax1, 5)
69 except myExcept as ec:
70 assert(ec.what() == "Transformation :: incorrect input data.")
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")