]> SALOME platform Git repositories - modules/shaper.git/blob - test.API/SHAPER/Transformations/TestAPI_Symmetry.py
Salome HOME
Merge remote-tracking branch 'origin/Toolbars_Management'
[modules/shaper.git] / test.API / SHAPER / Transformations / TestAPI_Symmetry.py
1 ## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
22 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
23 from GeomAPI import GeomAPI_Pnt as pnt
24 from GeomAPI import GeomAPI_Dir as direction
25 from GeomAPI import GeomAPI_Ax1 as axis
26 from GeomAPI import GeomAPI_Ax2 as plane
27 from GeomAPI import GeomAPI_Shape as shape
28
29 # Create boxes
30 Box_1 = shaperpy.makeBox(10., 10., 10.)
31 Box_2 = shaperpy.makeBox(10., 10., 10.)
32 Box_3 = shaperpy.makeBox(10., 10., 10.)
33 Box_4 = shaperpy.makeBox(10., 10., 10.)
34 Box_5 = shaperpy.makeBox(10., 10., 10.)
35 Box_6 = shaperpy.makeBox(10., 10., 10.)
36 Box_7 = shaperpy.makeBox(10., 10., 10.)
37 Box_8 = shaperpy.makeBox(10., 10., 10.)
38 Box_9 = shaperpy.makeBox(10., 10., 10.)
39 Box_10 = shaperpy.makeBox(10., 10., 10.)
40 Box_11 = shaperpy.makeBox(10., 10., 10.)
41 Box_12 = shaperpy.makeBox(10., 10., 10.)
42 Box_13 = shaperpy.makeBox(10., 10., 10.)
43 Box_14 = shaperpy.makeBox(10., 10., 10.)
44 Box_15 = shaperpy.makeBox(10., 10., 10.)
45 Box_16 = shaperpy.makeBox(10., 10., 10.)
46 Box_17 = shaperpy.makeBox(10., 10., 10.)
47 Box_18 = shaperpy.makeBox(10., 10., 10.)
48
49 # Create points
50 origin = pnt(0., 0., 0.)
51 pnt1 = pnt(-10., -10., -10)
52
53 # Create Axis
54 dirZ = direction(0., 0., 10.)
55 axZ = axis(origin, dirZ)
56
57 dir1 = direction(10., 10., 10.)
58 ax1 = axis(origin, dir1)
59
60 # Create Planes
61 planeXOY = plane(origin, dirZ)
62
63 Symmetry_1 = shaperpy.makeSymmetry(Box_1, origin)
64 Symmetry_2 = shaperpy.makeSymmetry(Box_2, pnt1)
65
66 try :
67     Symmetry_3 = shaperpy.makeSymmetry(Box_3, None)
68 except myExcept as ec :
69     assert(ec.what() == "Symmetry builder :: point is not valid.")
70
71 Symmetry_4 = shaperpy.makeSymmetry(Box_4, axZ)
72 Symmetry_5 = shaperpy.makeSymmetry(Box_5, ax1)
73 Symmetry_6 = shaperpy.makeSymmetry(Box_6, planeXOY)
74
75 try :
76     Symmetry_7 = shaperpy.makeSymmetry(None, pnt1)
77 except myExcept as ec :
78     assert(ec.what() == "Symmetry builder :: source shape is not valid.")
79
80 try :
81     Symmetry_8 = shaperpy.makeSymmetry(None, axZ)
82 except myExcept as ec :
83     assert(ec.what() == "Symmetry builder :: source shape is not valid.")
84
85 try :
86     Symmetry_9 = shaperpy.makeSymmetry(None, planeXOY)
87 except myExcept as ec :
88     assert(ec.what() == "Symmetry builder :: source shape is not valid.")
89
90 try :
91     Symmetry_10 = shaperpy.makeSymmetry(shape(), pnt1)
92 except myExcept as ec :
93     assert(ec.what() == "Symmetry builder :: source shape does not contain any actual shape.")