Salome HOME
Add tests.
[modules/shaper.git] / test.API / SHAPER / Transformations / TestAPI_Symmetry.py
1 # Copyright (C) 2014-2016 CEA/DEN, EDF R&D
2
3 # File:        TestAPI_Symmetry.py
4 # Created:     15 Nov 2016
5 # Author:      Clarisse Genrault (CEA)
6 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
7 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
8 from GeomAPI import GeomAPI_Pnt as pnt
9 from GeomAPI import GeomAPI_Dir as direction
10 from GeomAPI import GeomAPI_Ax1 as axis
11 from GeomAPI import GeomAPI_Ax2 as plane
12
13 # Create boxes
14 Box_1 = shaperpy.makeBox(10., 10., 10.)
15 Box_2 = shaperpy.makeBox(10., 10., 10.)
16 Box_3 = shaperpy.makeBox(10., 10., 10.)
17 Box_4 = shaperpy.makeBox(10., 10., 10.)
18 Box_5 = shaperpy.makeBox(10., 10., 10.)
19 Box_6 = shaperpy.makeBox(10., 10., 10.)
20 Box_7 = shaperpy.makeBox(10., 10., 10.)
21 Box_8 = shaperpy.makeBox(10., 10., 10.)
22 Box_9 = shaperpy.makeBox(10., 10., 10.)
23 Box_10 = shaperpy.makeBox(10., 10., 10.)
24 Box_11 = shaperpy.makeBox(10., 10., 10.)
25 Box_12 = shaperpy.makeBox(10., 10., 10.)
26 Box_13 = shaperpy.makeBox(10., 10., 10.)
27 Box_14 = shaperpy.makeBox(10., 10., 10.)
28 Box_15 = shaperpy.makeBox(10., 10., 10.)
29 Box_16 = shaperpy.makeBox(10., 10., 10.)
30 Box_17 = shaperpy.makeBox(10., 10., 10.)
31 Box_18 = shaperpy.makeBox(10., 10., 10.)
32
33 # Create points
34 origin = pnt(0., 0., 0.)
35 pnt1 = pnt(-10., -10., -10)
36
37 # Create Axis
38 dirZ = direction(0., 0., 10.)
39 axZ = axis(origin, dirZ)
40
41 dir1 = direction(10., 10., 10.)
42 ax1 = axis(origin, dir1)
43
44 # Create Planes
45 planeXOY = plane(origin, dirZ)
46
47 Symmetry_1 = shaperpy.makeSymmetry(Box_1, origin)
48 Symmetry_2 = shaperpy.makeSymmetry(Box_2, pnt1)
49
50 try :
51     Symmetry_6 = shaperpy.makeSymmetry(Box_2, None)
52 except myExcept,ec :
53     assert(ec.what() == "Symmetry builder :: point is not valid.")
54
55 Symmetry_7 = shaperpy.makeSymmetry(Box_7, axZ)
56 Symmetry_8 = shaperpy.makeSymmetry(Box_8, ax1)
57 Symmetry_13 = shaperpy.makeSymmetry(Box_13, planeXOY)