|
||||
File indexing completed on 2025-01-18 10:03:09
0001 // Created on: 1993-07-12 0002 // Created by: Remi LEQUETTE 0003 // Copyright (c) 1993-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _BRepBuilderAPI_MakeFace_HeaderFile 0018 #define _BRepBuilderAPI_MakeFace_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <BRepLib_MakeFace.hxx> 0025 #include <BRepBuilderAPI_MakeShape.hxx> 0026 #include <Standard_Real.hxx> 0027 #include <BRepBuilderAPI_FaceError.hxx> 0028 class TopoDS_Face; 0029 class gp_Pln; 0030 class gp_Cylinder; 0031 class gp_Cone; 0032 class gp_Sphere; 0033 class gp_Torus; 0034 class Geom_Surface; 0035 class TopoDS_Wire; 0036 0037 0038 //! Provides methods to build faces. 0039 //! 0040 //! A face may be built : 0041 //! 0042 //! * From a surface. 0043 //! 0044 //! - Elementary surface from gp. 0045 //! 0046 //! - Surface from Geom. 0047 //! 0048 //! * From a surface and U,V values. 0049 //! 0050 //! * From a wire. 0051 //! 0052 //! - Find the surface automatically if possible. 0053 //! 0054 //! * From a surface and a wire. 0055 //! 0056 //! - A flag Inside is given, when this flag is True 0057 //! the wire is oriented to bound a finite area on 0058 //! the surface. 0059 //! 0060 //! * From a face and a wire. 0061 //! 0062 //! - The new wire is a perforation. 0063 class BRepBuilderAPI_MakeFace : public BRepBuilderAPI_MakeShape 0064 { 0065 public: 0066 0067 DEFINE_STANDARD_ALLOC 0068 0069 0070 //! Not done. 0071 Standard_EXPORT BRepBuilderAPI_MakeFace(); 0072 0073 //! Load a face. useful to add wires. 0074 Standard_EXPORT BRepBuilderAPI_MakeFace(const TopoDS_Face& F); 0075 0076 //! Make a face from a plane. 0077 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Pln& P); 0078 0079 //! Make a face from a cylinder. 0080 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cylinder& C); 0081 0082 //! Make a face from a cone. 0083 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cone& C); 0084 0085 //! Make a face from a sphere. 0086 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Sphere& S); 0087 0088 //! Make a face from a torus. 0089 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C); 0090 0091 //! Make a face from a Surface. Accepts tolerance value (TolDegen) 0092 //! for resolution of degenerated edges. 0093 Standard_EXPORT BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, const Standard_Real TolDegen); 0094 0095 //! Make a face from a plane. 0096 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Pln& P, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax); 0097 0098 //! Make a face from a cylinder. 0099 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cylinder& C, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax); 0100 0101 //! Make a face from a cone. 0102 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cone& C, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax); 0103 0104 //! Make a face from a sphere. 0105 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Sphere& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax); 0106 0107 //! Make a face from a torus. 0108 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax); 0109 0110 //! Make a face from a Surface. Accepts tolerance value (TolDegen) 0111 //! for resolution of degenerated edges. 0112 Standard_EXPORT BRepBuilderAPI_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); 0113 0114 //! Find a surface from the wire and make a face. 0115 //! if <OnlyPlane> is true, the computed surface will be 0116 //! a plane. If it is not possible to find a plane, the 0117 //! flag NotDone will be set. 0118 Standard_EXPORT BRepBuilderAPI_MakeFace(const TopoDS_Wire& W, const Standard_Boolean OnlyPlane = Standard_False); 0119 0120 //! Make a face from a plane and a wire. 0121 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Pln& P, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True); 0122 0123 //! Make a face from a cylinder and a wire. 0124 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cylinder& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True); 0125 0126 //! Make a face from a cone and a wire. 0127 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Cone& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True); 0128 0129 //! Make a face from a sphere and a wire. 0130 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Sphere& S, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True); 0131 0132 //! Make a face from a torus and a wire. 0133 Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True); 0134 0135 //! Make a face from a Surface and a wire. 0136 //! If the surface S is not plane, 0137 //! it must contain pcurves for all edges in W, 0138 //! otherwise the wrong shape will be created. 0139 Standard_EXPORT BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True); 0140 0141 //! Adds the wire <W> in the face <F> 0142 //! A general method to create a face is to give 0143 //! - a surface S as the support (the geometric domain) of the face, 0144 //! - and a wire W to bound it. 0145 //! The bounds of the face can also be defined by four parameter values 0146 //! umin, umax, vmin, vmax which determine isoparametric limitations on 0147 //! the parametric space of the surface. In this way, a patch is 0148 //! defined. The parameter values are optional. If they are omitted, the 0149 //! natural bounds of the surface are used. A wire is automatically 0150 //! built using the defined bounds. Up to four edges and four vertices 0151 //! are created with this wire (no edge is created when the 0152 //! corresponding parameter value is infinite). 0153 //! Wires can then be added using the function Add to define other 0154 //! restrictions on the face. These restrictions represent holes. More 0155 //! than one wire may be added by this way, provided that the wires do 0156 //! not cross each other and that they define only one area on the 0157 //! surface. (Be careful, however, as this is not checked). 0158 //! Forbidden addition of wires 0159 //! Note that in this schema, the third case is valid if edges of the 0160 //! wire W are declared internal to the face. As a result, these edges 0161 //! are no longer bounds of the face. 0162 //! A default tolerance (Precision::Confusion()) is given to the face, 0163 //! this tolerance may be increased during construction of the face 0164 //! using various algorithms. 0165 //! Rules applied to the arguments 0166 //! For the surface: 0167 //! - The surface must not be a 'null handle'. 0168 //! - If the surface is a trimmed surface, the basis surface is used. 0169 //! - For the wire: the wire is composed of connected edges, each 0170 //! edge having a parametric curve description in the parametric 0171 //! domain of the surface; in other words, as a pcurve. 0172 //! For the parameters: 0173 //! - The parameter values must be in the parametric range of the 0174 //! surface (or the basis surface, if the surface is trimmed). If this 0175 //! condition is not satisfied, the face is not built, and the Error 0176 //! function will return BRepBuilderAPI_ParametersOutOfRange. 0177 //! - The bounding parameters p1 and p2 are adjusted on a periodic 0178 //! surface in a given parametric direction by adding or subtracting 0179 //! the period to obtain p1 in the parametric range of the surface and 0180 //! such p2, that p2 - p1 <= Period, where Period is the period of the 0181 //! surface in this parametric direction. 0182 //! - A parameter value may be infinite. There will be no edge and 0183 //! no vertex in the corresponding direction. 0184 Standard_EXPORT BRepBuilderAPI_MakeFace(const TopoDS_Face& F, const TopoDS_Wire& W); 0185 0186 //! Initializes (or reinitializes) the 0187 //! construction of a face by creating a new object which is a copy of 0188 //! the face F, in order to add wires to it, using the function Add. 0189 //! Note: this complete copy of the geometry is only required if you 0190 //! want to work on the geometries of the two faces independently. 0191 Standard_EXPORT void Init (const TopoDS_Face& F); 0192 0193 //! Initializes (or reinitializes) the construction of a face on 0194 //! the surface S. If Bound is true, a wire is 0195 //! automatically created from the natural bounds of the 0196 //! surface S and added to the face in order to bound it. If 0197 //! Bound is false, no wire is added. This option is used 0198 //! when real bounds are known. These will be added to 0199 //! the face after this initialization, using the function Add. 0200 //! TolDegen parameter is used for resolution of degenerated edges 0201 //! if calculation of natural bounds is turned on. 0202 Standard_EXPORT void Init (const Handle(Geom_Surface)& S, const Standard_Boolean Bound, const Standard_Real TolDegen); 0203 0204 //! Initializes (or reinitializes) the construction of a face on 0205 //! the surface S, limited in the u parametric direction by 0206 //! the two parameter values UMin and UMax and in the 0207 //! v parametric direction by the two parameter values VMin and VMax. 0208 //! Warning 0209 //! Error returns: 0210 //! - BRepBuilderAPI_ParametersOutOfRange 0211 //! when the parameters given are outside the bounds of the 0212 //! surface or the basis surface of a trimmed surface. 0213 //! TolDegen parameter is used for resolution of degenerated edges. 0214 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); 0215 0216 //! Adds the wire W to the constructed face as a hole. 0217 //! Warning 0218 //! W must not cross the other bounds of the face, and all 0219 //! the bounds must define only one area on the surface. 0220 //! (Be careful, however, as this is not checked.) 0221 //! Example 0222 //! // a cylinder 0223 //! gp_Cylinder C = ..; 0224 //! // a wire 0225 //! TopoDS_Wire W = ...; 0226 //! BRepBuilderAPI_MakeFace MF(C); 0227 //! MF.Add(W); 0228 //! TopoDS_Face F = MF; 0229 Standard_EXPORT void Add (const TopoDS_Wire& W); 0230 0231 //! Returns true if this algorithm has a valid face. 0232 Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; 0233 0234 //! Returns the construction status 0235 //! BRepBuilderAPI_FaceDone if the face is built, or 0236 //! - another value of the BRepBuilderAPI_FaceError 0237 //! enumeration indicating why the construction failed, in 0238 //! particular when the given parameters are outside the 0239 //! bounds of the surface. 0240 Standard_EXPORT BRepBuilderAPI_FaceError Error() const; 0241 0242 //! Returns the constructed face. 0243 //! Exceptions 0244 //! StdFail_NotDone if no face is built. 0245 Standard_EXPORT const TopoDS_Face& Face() const; 0246 Standard_EXPORT operator TopoDS_Face() const; 0247 0248 0249 0250 0251 protected: 0252 0253 0254 0255 0256 0257 private: 0258 0259 0260 0261 BRepLib_MakeFace myMakeFace; 0262 0263 0264 }; 0265 0266 0267 0268 0269 0270 0271 0272 #endif // _BRepBuilderAPI_MakeFace_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |