1 ## Copyright (C) 2014-2017 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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
22 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
23 from GeomAPI import GeomAPI_Pnt as pnt
25 # Create a box with dimensions
26 Box_1 = shaperpy.makeBox(10.,10.,10.)
29 Box_2 = shaperpy.makeBox(0.,10.,10.)
31 assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
34 Box_3 = shaperpy.makeBox(10.,0.,10.)
36 assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
39 Box_4 = shaperpy.makeBox(10.,10.,0.)
41 assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
44 Box_5 = shaperpy.makeBox(-10.,10.,10.)
46 assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
49 Box_6 = shaperpy.makeBox(10.,-10.,10.)
51 assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
54 Box_7 = shaperpy.makeBox(10.,10.,-10.)
56 assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
58 # Create a box with two points defining the diagonal
60 pnt2 = pnt(50.,50.,50.)
61 Box_8 = shaperpy.makeBox(pnt1,pnt2)
64 Box_9 = shaperpy.makeBox(pnt1,pnt1)
66 assert(ec.what() == "Box builder with points :: the distance between the two points is null.")
69 pnt3 = pnt(0.,50.,50.)
70 Box_10 = shaperpy.makeBox(pnt1,pnt3)
72 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
75 pnt4 = pnt(50.,0.,50.)
76 Box_11 = shaperpy.makeBox(pnt1,pnt4)
78 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
81 pnt5 = pnt(50.,50.,0.)
82 Box_12 = shaperpy.makeBox(pnt1,pnt5)
84 assert(ec.what() == "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.")
87 Box_13 = shaperpy.makeBox(None, pnt2)
89 assert(ec.what() == "Box builder with points :: the first point is not valid.")
92 Box_14 = shaperpy.makeBox(pnt2, None)
94 assert(ec.what() == "Box builder with points :: the second point is not valid.")