1 // Created on: 1993-07-21
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepPrimAPI_MakeBox_HeaderFile
18 #define _BRepPrimAPI_MakeBox_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <BRepPrim_Wedge.hxx>
25 #include <BRepBuilderAPI_MakeShape.hxx>
26 #include <Standard_Real.hxx>
27 class Standard_DomainError;
28 class Standard_OutOfRange;
29 class StdFail_NotDone;
38 //! Describes functions to build parallelepiped boxes.
39 //! A MakeBox object provides a framework for:
40 //! - defining the construction of a box,
41 //! - implementing the construction algorithm, and
42 //! - consulting the result.
43 //! Constructs a box such that its sides are parallel to the axes of
44 //! - the global coordinate system, or
45 //! - the local coordinate system Axis. and
46 //! - with a corner at (0, 0, 0) and of size (dx, dy, dz), or
47 //! - with a corner at point P and of size (dx, dy, dz), or
48 //! - with corners at points P1 and P2.
50 //! Standard_DomainError if: dx, dy, dz are less than or equal to
51 //! Precision::Confusion(), or
52 //! - the vector joining the points P1 and P2 has a
53 //! component projected onto the global coordinate
54 //! system less than or equal to Precision::Confusion().
55 //! In these cases, the box would be flat.
57 class BRepPrimAPI_MakeBox : public BRepBuilderAPI_MakeShape
64 //! Default constructor
65 BRepPrimAPI_MakeBox() {}
67 //! Make a box with a corner at 0,0,0 and the other dx,dy,dz
68 Standard_EXPORT BRepPrimAPI_MakeBox(const Standard_Real dx, const Standard_Real dy, const Standard_Real dz);
70 //! Make a box with a corner at P and size dx, dy, dz.
71 Standard_EXPORT BRepPrimAPI_MakeBox(const gp_Pnt& P, const Standard_Real dx, const Standard_Real dy, const Standard_Real dz);
73 //! Make a box with corners P1,P2.
74 Standard_EXPORT BRepPrimAPI_MakeBox(const gp_Pnt& P1, const gp_Pnt& P2);
76 //! Make a box with Ax2 (the left corner and the axis) and size dx, dy, dz.
77 Standard_EXPORT BRepPrimAPI_MakeBox(const gp_Ax2& Axes, const Standard_Real dx, const Standard_Real dy, const Standard_Real dz);
79 //! Init a box with a corner at 0,0,0 and the other theDX, theDY, theDZ
80 Standard_EXPORT void Init (const Standard_Real theDX, const Standard_Real theDY, const Standard_Real theDZ);
82 //! Init a box with a corner at thePnt and size theDX, theDY, theDZ.
83 Standard_EXPORT void Init (const gp_Pnt& thePnt,
84 const Standard_Real theDX,
85 const Standard_Real theDY,
86 const Standard_Real theDZ);
88 //! Init a box with corners thePnt1, thePnt2.
89 Standard_EXPORT void Init (const gp_Pnt& thePnt1, const gp_Pnt& thePnt2);
91 //! Init a box with Ax2 (the left corner and the theAxes) and size theDX, theDY, theDZ.
92 Standard_EXPORT void Init (const gp_Ax2& theAxes,
93 const Standard_Real theDX,
94 const Standard_Real theDY,
95 const Standard_Real theDZ);
97 //! Returns the internal algorithm.
98 Standard_EXPORT BRepPrim_Wedge& Wedge();
100 //! Stores the solid in myShape.
101 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
103 //! Returns the constructed box as a shell.
104 Standard_EXPORT const TopoDS_Shell& Shell();
105 Standard_EXPORT operator TopoDS_Shell();
107 //! Returns the constructed box as a solid.
108 Standard_EXPORT const TopoDS_Solid& Solid();
109 Standard_EXPORT operator TopoDS_Solid();
111 //! Returns ZMin face
112 Standard_EXPORT const TopoDS_Face& BottomFace();
114 //! Returns XMin face
115 Standard_EXPORT const TopoDS_Face& BackFace();
117 //! Returns XMax face
118 Standard_EXPORT const TopoDS_Face& FrontFace();
120 //! Returns YMin face
121 Standard_EXPORT const TopoDS_Face& LeftFace();
123 //! Returns YMax face
124 Standard_EXPORT const TopoDS_Face& RightFace();
126 //! Returns ZMax face
127 Standard_EXPORT const TopoDS_Face& TopFace();
135 BRepPrim_Wedge myWedge;
153 #endif // _BRepPrimAPI_MakeBox_HeaderFile