1 # Copyright (C) 2014-201x CEA/DEN, EDF R&D
3 # File: TestAPI_MultiTranslation.py
5 # Author: Sylvain Chouteau (Alyotech)
7 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
8 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
9 from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction
12 Box_1 = shaperpy.makeBox(10.,10.,10.)
13 Box_2 = shaperpy.makeBox(10.,10.,10.)
14 Box_3 = shaperpy.makeBox(10.,10.,10.)
15 Box_4 = shaperpy.makeBox(10.,10.,10.)
16 Box_5 = shaperpy.makeBox(10.,10.,10.)
17 Box_6 = shaperpy.makeBox(10.,10.,10.)
18 Box_7 = shaperpy.makeBox(10.,10.,10.)
19 Box_8 = shaperpy.makeBox(10.,10.,10.)
22 pntOrigin = pnt(0.,0.,0.)
24 pnt2 = pnt(10.,10.,0.)
27 xDir = direction(10., 0., 0.)
28 ax1 = axis(pntOrigin, xDir)
30 yDir = direction(0., 10., 0.)
31 ax2 = axis(pntOrigin, yDir)
34 # Create MultiTranslations
35 MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_1, ax1, 15., 5)
36 MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_2, ax1, -15., 5)
39 MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_3, ax1, 15., -2)
41 assert(ec.what() == "Multitranslation builder :: the number of copies for the first direction is null or negative.")
43 MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_5, ax1, 10., 5, ax2, 10., 5)
44 MultiTranslation_6 = shaperpy.makeMultiTranslation(Box_6, ax1, 15., 5, ax2, -10., 5)
48 # MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_4, None, 15., 2)
50 # assert(ec.what() == "Multitranslation builder :: the first axis is not valid.")
52 # Pas d'exception levee alors qu'une devrait y en avoir une
54 MultiTranslation_7 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., 5, ax2, 10., -2)
56 assert(ec.what() == "Multitranslation builder :: the number of copies for the second direction is null or negative.")
59 # MultiTranslation_8 = shaperpy.makeMultiTranslation(Box_8, ax1, 15., 5, None, 10., 5)
61 # assert(ec.what() == "Multitranslation builder :: the second axis is not valid.")