1 ## Copyright (C) 2014-2017 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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
22 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
23 from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction
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 Box_13 = shaperpy.makeBox(10.,10.,10.)
39 Box_14 = shaperpy.makeBox(10.,10.,10.)
40 Box_15 = shaperpy.makeBox(10.,10.,10.)
43 pntOrigin = pnt(0.,0.,0.)
45 pnt2 = pnt(20.,20.,0.)
46 pnt3 = pnt(-10.,0.,0.)
49 zDir = direction(0., 0., 10.)
50 ax1 = axis(pntOrigin, zDir)
54 Rotation_1 = shaperpy.makeRotation(Box_1, ax1, 45)
55 Rotation_2 = shaperpy.makeRotation(Box_2, ax1, 0)
56 Rotation_3 = shaperpy.makeRotation(Box_3, ax1, 360)
57 Rotation_4 = shaperpy.makeRotation(Box_4, ax1, -360)
60 Rotation_5 = shaperpy.makeRotation(Box_5, ax1, 450)
62 assert(ec.what() == "Rotation builder :: angle greater than 360 degrees.")
65 Rotation_6 = shaperpy.makeRotation(Box_6, ax1, -450)
67 assert(ec.what() == "Rotation builder :: angle smaller than -360 degrees.")
70 Rotation_7 = shaperpy.makeRotation(Box_7, None, 180)
72 assert(ec.what() == "Rotation builder :: axis is not valid.")
75 Rotation_8 = shaperpy.makeRotation(None, ax1, 180)
77 assert(ec.what() == "Rotation builder :: source shape is not valid.")
79 Rotation_9 = shaperpy.makeRotation(Box_8, pntOrigin, pnt1, pnt2)
80 Rotation_10 = shaperpy.makeRotation(Box_9, pnt3, pnt1, pnt2)
83 Rotation_11 = shaperpy.makeRotation(Box_10, pnt3, pnt1, pnt1)
85 assert(ec.what() == "Rotation builder :: start point and end point coincide.")
88 Rotation_12 = shaperpy.makeRotation(Box_11, pnt3, pnt3, pnt1)
90 assert(ec.what() == "Rotation builder :: center point and start point coincide.")
93 Rotation_13 = shaperpy.makeRotation(Box_12, pnt3, pnt1, pnt3)
95 assert(ec.what() == "Rotation builder :: center point and end point coincide.")
98 Rotation_14 = shaperpy.makeRotation(Box_13, pntOrigin, pnt1, None)
100 assert(ec.what() == "Rotation builder :: end point is not valid.")
103 Rotation_15 = shaperpy.makeRotation(Box_14, None, pnt3, pnt2)
105 assert(ec.what() == "Rotation builder :: center point is not valid.")
108 Rotation_16 = shaperpy.makeRotation(Box_15, pntOrigin, None, pnt1)
110 assert(ec.what() == "Rotation builder :: start point is not valid.")
113 Rotation_17 = shaperpy.makeRotation(None, pntOrigin, pnt3, pnt2)
115 assert(ec.what() == "Rotation builder :: source shape is not valid.")