1 # Copyright (C) 2014-2024 CEA, EDF
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_Pnt as pnt
24 # Create a box with dimensions
25 Box_1 = shaperpy.makeBox(10.,10.,10.)
28 Box_2 = shaperpy.makeBox(0.,10.,10.)
29 except myExcept as ec:
30 assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
33 Box_3 = shaperpy.makeBox(10.,0.,10.)
34 except myExcept as ec:
35 assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
38 Box_4 = shaperpy.makeBox(10.,10.,0.)
39 except myExcept as ec:
40 assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
43 Box_5 = shaperpy.makeBox(-10.,10.,10.)
44 except myExcept as ec:
45 assert(ec.what() == "Box builder with dimensions :: Dx is null or negative.")
48 Box_6 = shaperpy.makeBox(10.,-10.,10.)
49 except myExcept as ec:
50 assert(ec.what() == "Box builder with dimensions :: Dy is null or negative.")
53 Box_7 = shaperpy.makeBox(10.,10.,-10.)
54 except myExcept as ec:
55 assert(ec.what() == "Box builder with dimensions :: Dz is null or negative.")
57 # Create a box with two points defining the diagonal
59 pnt2 = pnt(50.,50.,50.)
60 Box_8 = shaperpy.makeBox(pnt1,pnt2)
63 Box_9 = shaperpy.makeBox(pnt1,pnt1)
64 except myExcept as ec:
65 assert(ec.what() == "Box builder with two points :: the distance between the two points is null.")
68 pnt3 = pnt(0.,50.,50.)
69 Box_10 = shaperpy.makeBox(pnt1,pnt3)
70 except myExcept as ec:
71 assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.")
74 pnt4 = pnt(50.,0.,50.)
75 Box_11 = shaperpy.makeBox(pnt1,pnt4)
76 except myExcept as ec:
77 assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.")
80 pnt5 = pnt(50.,50.,0.)
81 Box_12 = shaperpy.makeBox(pnt1,pnt5)
82 except myExcept as ec:
83 assert(ec.what() == "Box builder with two points :: the points belong both to one of the OXY, OYZ or OZX planes.")
86 Box_13 = shaperpy.makeBox(None, pnt2)
87 except myExcept as ec:
88 assert(ec.what() == "Box builder with two points :: the first point is not valid.")
91 Box_14 = shaperpy.makeBox(pnt2, None)
92 except myExcept as ec:
93 assert(ec.what() == "Box builder with two points :: the second point is not valid.")