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.)
18 assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
21 Box_3 = shaperpy.makeBox(10.,0.,10.)
24 assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
27 Box_4 = shaperpy.makeBox(10.,10.,0.)
30 assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
33 Box_5 = shaperpy.makeBox(-10.,10.,10.)
36 assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
39 Box_6 = shaperpy.makeBox(10.,-10.,10.)
42 assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
45 Box_7 = shaperpy.makeBox(10.,10.,-10.)
48 assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
50 # Create a box with two points defining the diagonal
52 pnt2 = pnt(50.,50.,50.)
53 Box_8 = shaperpy.makeBox(pnt1,pnt2)
56 Box_9 = shaperpy.makeBox(pnt1,pnt1)
59 assert(ec.what() == "Box builder with points :: the distance between the two points is null.")
62 pnt3 = pnt(0.,50.,50.)
63 Box_10 = shaperpy.makeBox(pnt1,pnt3)
66 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
69 pnt4 = pnt(50.,0.,50.)
70 Box_11 = shaperpy.makeBox(pnt1,pnt4)
73 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
76 pnt5 = pnt(50.,50.,0.)
77 Box_12 = shaperpy.makeBox(pnt1,pnt5)
80 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
83 Box_13 = shaperpy.makeBox(pnt2,None)
86 assert(ec.what() == "Box builder with points :: the second point is not correct.")
89 Box_14 = shaperpy.makeBox(None,pnt2)
92 assert(ec.what() == "Box builder with points :: the first point is not correct.")