1 # Copyright (C) 2014-2016 CEA/DEN, EDF R&D
4 # Created: 16 Sept 2016
5 # Author: Clarisse Genrault (CEA)
7 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
8 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
9 from GeomAPI import GeomAPI_Pnt as pnt
11 # Create a box with dimensions
12 Box_1 = shaperpy.makeBox(10.,10.,10.)
15 Box_2 = shaperpy.makeBox(0.,10.,10.)
17 assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
20 Box_3 = shaperpy.makeBox(10.,0.,10.)
22 assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
25 Box_4 = shaperpy.makeBox(10.,10.,0.)
27 assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
30 Box_5 = shaperpy.makeBox(-10.,10.,10.)
32 assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
35 Box_6 = shaperpy.makeBox(10.,-10.,10.)
37 assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
40 Box_7 = shaperpy.makeBox(10.,10.,-10.)
42 assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
44 # Create a box with two points defining the diagonal
46 pnt2 = pnt(50.,50.,50.)
47 Box_8 = shaperpy.makeBox(pnt1,pnt2)
50 Box_9 = shaperpy.makeBox(pnt1,pnt1)
52 assert(ec.what() == "Box builder with points :: the distance between the two points is null.")
55 pnt3 = pnt(0.,50.,50.)
56 Box_10 = shaperpy.makeBox(pnt1,pnt3)
58 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
61 pnt4 = pnt(50.,0.,50.)
62 Box_11 = shaperpy.makeBox(pnt1,pnt4)
64 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
67 pnt5 = pnt(50.,50.,0.)
68 Box_12 = shaperpy.makeBox(pnt1,pnt5)
70 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
73 Box_13 = shaperpy.makeBox(None, pnt2)
75 assert(ec.what() == "Box builder with points :: the first point is not valid.")
78 Box_14 = shaperpy.makeBox(pnt2, None)
80 assert(ec.what() == "Box builder with points :: the second point is not valid.")