Salome HOME
Merge branch 'master' into cgt/devCEA
[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
28 # Create boxes
29 Box_1 = shaperpy.makeBox(10., 10., 10.)
30 Box_2 = shaperpy.makeBox(10., 10., 10.)
31 Box_3 = shaperpy.makeBox(10., 10., 10.)
32 Box_4 = shaperpy.makeBox(10., 10., 10.)
33 Box_5 = shaperpy.makeBox(10., 10., 10.)
34 Box_6 = shaperpy.makeBox(10., 10., 10.)
35 Box_7 = shaperpy.makeBox(10., 10., 10.)
36 Box_8 = shaperpy.makeBox(10., 10., 10.)
37 Box_9 = shaperpy.makeBox(10., 10., 10.)
38 Box_10 = shaperpy.makeBox(10., 10., 10.)
39 Box_11 = shaperpy.makeBox(10., 10., 10.)
40 Box_12 = shaperpy.makeBox(10., 10., 10.)
41 Box_13 = shaperpy.makeBox(10., 10., 10.)
42 Box_14 = shaperpy.makeBox(10., 10., 10.)
43 Box_15 = shaperpy.makeBox(10., 10., 10.)
44 Box_16 = shaperpy.makeBox(10., 10., 10.)
45 Box_17 = shaperpy.makeBox(10., 10., 10.)
46 Box_18 = shaperpy.makeBox(10., 10., 10.)
47
48 # Create points
49 origin = pnt(0., 0., 0.)
50 pnt1 = pnt(-10., -10., -10)
51
52 # Create Axis
53 dirZ = direction(0., 0., 10.)
54 axZ = axis(origin, dirZ)
55
56 dir1 = direction(10., 10., 10.)
57 ax1 = axis(origin, dir1)
58
59 # Create Planes
60 planeXOY = plane(origin, dirZ)
61
62 Symmetry_1 = shaperpy.makeSymmetry(Box_1, origin)
63 Symmetry_2 = shaperpy.makeSymmetry(Box_2, pnt1)
64
65 try :
66     Symmetry_6 = shaperpy.makeSymmetry(Box_2, None)
67 except myExcept,ec :
68     assert(ec.what() == "Symmetry builder :: point is not valid.")
69
70 Symmetry_7 = shaperpy.makeSymmetry(Box_7, axZ)
71 Symmetry_8 = shaperpy.makeSymmetry(Box_8, ax1)
72 Symmetry_13 = shaperpy.makeSymmetry(Box_13, planeXOY)