1 // Created on: 1993-07-12
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 _BRepLib_MakeFace_HeaderFile
18 #define _BRepLib_MakeFace_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <BRepLib_FaceError.hxx>
25 #include <BRepLib_MakeShape.hxx>
37 //! Provides methods to build faces.
39 //! A face may be built :
43 //! - Elementary surface from gp.
45 //! - Surface from Geom.
47 //! * From a surface and U,V values.
51 //! - Find the surface automatically if possible.
53 //! * From a surface and a wire.
55 //! - A flag Inside is given, when this flag is True
56 //! the wire is oriented to bound a finite area on
59 //! * From a face and a wire.
61 //! - The new wire is a perforation.
62 class BRepLib_MakeFace : public BRepLib_MakeShape
70 Standard_EXPORT BRepLib_MakeFace();
72 //! Load a face. Useful to add wires.
73 Standard_EXPORT BRepLib_MakeFace(const TopoDS_Face& F);
75 //! Make a face from a plane.
76 Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P);
78 //! Make a face from a cylinder.
79 Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C);
81 //! Make a face from a cone.
82 Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C);
84 //! Make a face from a sphere.
85 Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S);
87 //! Make a face from a torus.
88 Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C);
90 //! Make a face from a Surface. Accepts tolerance value (TolDegen)
91 //! for resolution of degenerated edges.
92 Standard_EXPORT BRepLib_MakeFace(const Handle(Geom_Surface)& S, const Standard_Real TolDegen);
94 //! Make a face from a plane.
95 Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax);
97 //! Make a face from a cylinder.
98 Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax);
100 //! Make a face from a cone.
101 Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax);
103 //! Make a face from a sphere.
104 Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax);
106 //! Make a face from a torus.
107 Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax);
109 //! Make a face from a Surface. Accepts min & max parameters
110 //! to construct the face's bounds. Also accepts tolerance value (TolDegen)
111 //! for resolution of degenerated edges.
112 Standard_EXPORT BRepLib_MakeFace(const Handle(Geom_Surface)& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real TolDegen);
114 //! Find a surface from the wire and make a face.
115 //! if <OnlyPlane> is true, the computed surface will be
116 //! a plane. If it is not possible to find a plane, the
117 //! flag NotDone will be set.
118 Standard_EXPORT BRepLib_MakeFace(const TopoDS_Wire& W, const Standard_Boolean OnlyPlane = Standard_False);
120 //! Make a face from a plane and a wire.
121 Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
123 //! Make a face from a cylinder and a wire.
124 Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
126 //! Make a face from a cone and a wire.
127 Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
129 //! Make a face from a sphere and a wire.
130 Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
132 //! Make a face from a torus and a wire.
133 Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
135 //! Make a face from a Surface and a wire.
136 Standard_EXPORT BRepLib_MakeFace(const Handle(Geom_Surface)& S, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
138 //! Adds the wire <W> in the face <F>
139 Standard_EXPORT BRepLib_MakeFace(const TopoDS_Face& F, const TopoDS_Wire& W);
142 Standard_EXPORT void Init (const TopoDS_Face& F);
144 //! Creates the face from the surface. If Bound is
145 //! True a wire is made from the natural bounds.
146 //! Accepts tolerance value (TolDegen) for resolution
147 //! of degenerated edges.
148 Standard_EXPORT void Init (const Handle(Geom_Surface)& S, const Standard_Boolean Bound, const Standard_Real TolDegen);
150 //! Creates the face from the surface and the min-max
151 //! values. Accepts tolerance value (TolDegen) for resolution
152 //! of degenerated edges.
153 Standard_EXPORT void Init (const Handle(Geom_Surface)& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real TolDegen);
155 //! Adds the wire <W> in the current face.
156 Standard_EXPORT void Add (const TopoDS_Wire& W);
158 Standard_EXPORT BRepLib_FaceError Error() const;
160 //! Returns the new face.
161 Standard_EXPORT const TopoDS_Face& Face() const;
162 Standard_EXPORT operator TopoDS_Face() const;
164 //! Checks the specified curve is degenerated
165 //! according to specified tolerance.
166 //! Returns <theActTol> less than <theMaxTol>, which shows
167 //! actual tolerance to decide the curve is degenerated.
168 //! Warning: For internal use of BRepLib_MakeFace and BRepLib_MakeShell.
169 Standard_EXPORT static Standard_Boolean IsDegenerated (const Handle(Geom_Curve)& theCurve, const Standard_Real theMaxTol, Standard_Real& theActTol);
183 //! Reorient the current face if the boundary is not
185 Standard_EXPORT void CheckInside();
188 BRepLib_FaceError myError;
199 #endif // _BRepLib_MakeFace_HeaderFile