1 # Copyright (C) 2014-2021 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
21 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
22 from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction
25 Box_1 = shaperpy.makeBox(10.,10.,10.)
26 Box_2 = shaperpy.makeBox(10.,10.,10.)
27 Box_3 = shaperpy.makeBox(10.,10.,10.)
28 Box_4 = shaperpy.makeBox(10.,10.,10.)
29 Box_5 = shaperpy.makeBox(10.,10.,10.)
30 Box_6 = shaperpy.makeBox(10.,10.,10.)
31 Box_7 = shaperpy.makeBox(10.,10.,10.)
32 Box_8 = shaperpy.makeBox(10.,10.,10.)
35 pntOrigin = pnt(0.,0.,0.)
37 pnt2 = pnt(10.,10.,0.)
40 xDir = direction(10., 0., 0.)
41 ax1 = axis(pntOrigin, xDir)
43 yDir = direction(0., 10., 0.)
44 ax2 = axis(pntOrigin, yDir)
47 # Create MultiTranslations
48 MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_1, ax1, 15., 5)
49 MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_2, ax1, -15., 5)
52 MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_3, ax1, 15., -2)
53 except myExcept as ec:
54 assert(ec.what() == "Multitranslation builder :: the number of copies for the first direction is null or negative.")
56 MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_5, ax1, 10., 5, ax2, 10., 5)
57 MultiTranslation_6 = shaperpy.makeMultiTranslation(Box_6, ax1, 15., 5, ax2, -10., 5)
61 MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_4, None, 15., 2)
62 except myExcept as ec:
63 assert(ec.what() == "Multitranslation builder :: the first axis is not valid")
65 # Pas d'exception levee alors qu'une devrait y en avoir une
67 MultiTranslation_7 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., 5, ax2, 10., -2)
68 except myExcept as ec:
69 assert(ec.what() == "Multitranslation builder :: the number of copies for the second direction is null or negative.")
71 MultiTranslation_8 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., -2, ax2, 10., 5)
72 except myExcept as ec:
73 assert(ec.what() == "Multitranslation builder :: the number of copies for the first direction is null or negative.")
76 MultiTranslation_9 = shaperpy.makeMultiTranslation(Box_8, None, 15., 5, ax2, 10., 5)
77 except myExcept as ec:
78 assert(ec.what() == "Multitranslation builder :: the first axis is not valid")
81 MultiTranslation_10 = shaperpy.makeMultiTranslation(Box_8, ax1, 15., 5, None, 10., 5)
82 except myExcept as ec:
83 assert(ec.what() == "Multitranslation builder :: the second axis is not valid")