]> SALOME platform Git repositories - modules/shaper.git/blob - test.API/SHAPER/Transformations/TestAPI_MultiTranslation.py
Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / test.API / SHAPER / Transformations / TestAPI_MultiTranslation.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_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction
24
25 # Create Boxes
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
35 # Points
36 pntOrigin = pnt(0.,0.,0.)
37 pnt1 = pnt(10.,0.,0.)
38 pnt2 = pnt(10.,10.,0.)
39
40 # Axis
41 xDir = direction(10., 0., 0.)
42 ax1 = axis(pntOrigin, xDir)
43
44 yDir = direction(0., 10., 0.)
45 ax2 = axis(pntOrigin, yDir)
46
47
48 # Create MultiTranslations
49 MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_1, ax1, 15., 5)
50 MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_2, ax1, -15., 5)
51
52 try:
53     MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_3, ax1, 15., -2)
54 except myExcept,ec:
55     assert(ec.what() == "Multitranslation builder :: the number of copies for the first direction is null or negative.")
56
57 MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_5, ax1, 10., 5, ax2, 10., 5)
58 MultiTranslation_6 = shaperpy.makeMultiTranslation(Box_6, ax1, 15., 5, ax2, -10., 5)
59
60 # Tests en erreur
61 #try:
62 #    MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_4, None, 15., 2)
63 #except myExcept,ec:
64 #    assert(ec.what() == "Multitranslation builder :: the first axis is not valid.")
65
66 # Pas d'exception levee alors qu'une devrait y en avoir une
67 try:
68     MultiTranslation_7 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., 5, ax2, 10., -2)
69 except myExcept,ec:
70     assert(ec.what() == "Multitranslation builder :: the number of copies for the second direction is null or negative.")
71
72 #try:
73 #    MultiTranslation_8 = shaperpy.makeMultiTranslation(Box_8, ax1, 15., 5, None, 10., 5)
74 #except myExcept,ec:
75 #    assert(ec.what() == "Multitranslation builder :: the second axis is not valid.")