1 # Copyright (C) 2014-201x CEA/DEN, EDF R&D
3 # File: TestAPI_Rotation.py
5 # Author: Sylvain Chouteau (Alyotech)
7 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
8 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
9 from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction
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 Box_13 = shaperpy.makeBox(10.,10.,10.)
25 Box_14 = shaperpy.makeBox(10.,10.,10.)
26 Box_15 = shaperpy.makeBox(10.,10.,10.)
29 pntOrigin = pnt(0.,0.,0.)
31 pnt2 = pnt(20.,20.,0.)
32 pnt3 = pnt(-10.,0.,0.)
35 zDir = direction(0., 0., 10.)
36 ax1 = axis(pntOrigin, zDir)
40 Rotation_1 = shaperpy.makeRotation(Box_1, ax1, 45)
41 Rotation_2 = shaperpy.makeRotation(Box_2, ax1, 0)
42 Rotation_3 = shaperpy.makeRotation(Box_3, ax1, 360)
43 Rotation_4 = shaperpy.makeRotation(Box_4, ax1, -360)
46 Rotation_5 = shaperpy.makeRotation(Box_5, ax1, 450)
48 assert(ec.what() == "Rotation builder :: angle greater than 360 degrees.")
51 Rotation_6 = shaperpy.makeRotation(Box_6, ax1, -450)
53 assert(ec.what() == "Rotation builder :: angle smaller than -360 degrees.")
56 Rotation_7 = shaperpy.makeRotation(Box_7, None, 180)
58 assert(ec.what() == "Rotation builder :: axis is not valid.")
61 Rotation_8 = shaperpy.makeRotation(None, ax1, 180)
63 assert(ec.what() == "Rotation builder :: source shape is not valid.")
65 Rotation_9 = shaperpy.makeRotation(Box_8, pntOrigin, pnt1, pnt2)
66 Rotation_10 = shaperpy.makeRotation(Box_9, pnt3, pnt1, pnt2)
69 Rotation_11 = shaperpy.makeRotation(Box_10, pnt3, pnt1, pnt1)
71 assert(ec.what() == "Rotation builder :: start point and end point coincide.")
74 Rotation_12 = shaperpy.makeRotation(Box_11, pnt3, pnt3, pnt1)
76 assert(ec.what() == "Rotation builder :: center point and start point coincide.")
79 Rotation_13 = shaperpy.makeRotation(Box_12, pnt3, pnt1, pnt3)
81 assert(ec.what() == "Rotation builder :: center point and end point coincide.")
84 Rotation_14 = shaperpy.makeRotation(Box_13, pntOrigin, pnt1, None)
86 assert(ec.what() == "Rotation builder :: end point is not valid.")
89 Rotation_15 = shaperpy.makeRotation(Box_14, None, pnt3, pnt2)
91 assert(ec.what() == "Rotation builder :: center point is not valid.")
94 Rotation_16 = shaperpy.makeRotation(Box_15, pntOrigin, None, pnt1)
96 assert(ec.what() == "Rotation builder :: start point is not valid.")
99 Rotation_17 = shaperpy.makeRotation(None, pntOrigin, pnt3, pnt2)
101 assert(ec.what() == "Rotation builder :: source shape is not valid.")