|
||||
File indexing completed on 2025-01-18 10:03:12
0001 // Created on: 1994-06-17 0002 // Created by: Modeling 0003 // Copyright (c) 1994-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 _BRepFilletAPI_MakeFillet_HeaderFile 0018 #define _BRepFilletAPI_MakeFillet_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <ChFi3d_FilBuilder.hxx> 0025 #include <TopTools_MapOfShape.hxx> 0026 #include <BRepFilletAPI_LocalOperation.hxx> 0027 #include <ChFi3d_FilletShape.hxx> 0028 #include <Standard_Real.hxx> 0029 #include <GeomAbs_Shape.hxx> 0030 #include <TColgp_Array1OfPnt2d.hxx> 0031 #include <Standard_Integer.hxx> 0032 #include <TopTools_ListOfShape.hxx> 0033 #include <ChFiDS_SecHArray1.hxx> 0034 #include <ChFiDS_ErrorStatus.hxx> 0035 class TopoDS_Shape; 0036 class TopoDS_Edge; 0037 class Law_Function; 0038 class TopoDS_Vertex; 0039 class TopOpeBRepBuild_HBuilder; 0040 class Geom_Surface; 0041 0042 0043 //! Describes functions to build fillets on the broken edges of a shell or solid. 0044 //! A MakeFillet object provides a framework for: 0045 //! - initializing the construction algorithm with a given shape, 0046 //! - acquiring the data characterizing the fillets, 0047 //! - building the fillets and constructing the resulting shape, and 0048 //! - consulting the result. 0049 class BRepFilletAPI_MakeFillet : public BRepFilletAPI_LocalOperation 0050 { 0051 public: 0052 0053 DEFINE_STANDARD_ALLOC 0054 0055 0056 //! Initializes the computation of the fillets. 0057 //! <FShape> sets the type of fillet surface. The 0058 //! default value is ChFi3d_Rational (classical nurbs 0059 //! representation of circles). ChFi3d_QuasiAngular 0060 //! corresponds to a nurbs representation of circles 0061 //! which parameterisation matches the circle one. 0062 //! ChFi3d_Polynomial corresponds to a polynomial 0063 //! representation of circles. 0064 Standard_EXPORT BRepFilletAPI_MakeFillet(const TopoDS_Shape& S, const ChFi3d_FilletShape FShape = ChFi3d_Rational); 0065 0066 Standard_EXPORT void SetParams (const Standard_Real Tang, const Standard_Real Tesp, const Standard_Real T2d, const Standard_Real TApp3d, const Standard_Real TolApp2d, const Standard_Real Fleche); 0067 0068 //! Changes the parameters of continiuity 0069 //! InternalContinuity to produce fillet'surfaces with 0070 //! an continuity Ci (i=0,1 or 2). 0071 //! By defaultInternalContinuity = GeomAbs_C1. 0072 //! AngularTolerance is the G1 tolerance between fillet 0073 //! and support'faces. 0074 Standard_EXPORT void SetContinuity (const GeomAbs_Shape InternalContinuity, const Standard_Real AngularTolerance); 0075 0076 //! Adds a fillet contour in the builder (builds a 0077 //! contour of tangent edges). 0078 //! The Radius must be set after. 0079 Standard_EXPORT void Add (const TopoDS_Edge& E) Standard_OVERRIDE; 0080 0081 //! Adds a fillet description in the builder 0082 //! - builds a contour of tangent edges, 0083 //! - sets the radius. 0084 Standard_EXPORT void Add (const Standard_Real Radius, const TopoDS_Edge& E); 0085 0086 //! Adds a fillet description in the builder 0087 //! - builds a contour of tangent edges, 0088 //! - sets a linear radius evolution law between 0089 //! the first and last vertex of the spine. 0090 Standard_EXPORT void Add (const Standard_Real R1, const Standard_Real R2, const TopoDS_Edge& E); 0091 0092 //! Adds a fillet description in the builder 0093 //! - builds a contour of tangent edges, 0094 //! - sest the radius evolution law. 0095 Standard_EXPORT void Add (const Handle(Law_Function)& L, const TopoDS_Edge& E); 0096 0097 //! Adds a fillet description in the builder 0098 //! - builds a contour of tangent edges, 0099 //! - sets the radius evolution law interpolating the values 0100 //! given in the array UandR : 0101 //! 0102 //! p2d.X() = relative parameter on the spine [0,1] 0103 //! p2d.Y() = value of the radius. 0104 Standard_EXPORT void Add (const TColgp_Array1OfPnt2d& UandR, const TopoDS_Edge& E); 0105 0106 //! Sets the parameters of the fillet 0107 //! along the contour of index IC generated using the Add function 0108 //! in the internal data structure of 0109 //! this algorithm, where Radius is the radius of the fillet. 0110 Standard_EXPORT void SetRadius (const Standard_Real Radius, const Standard_Integer IC, const Standard_Integer IinC); 0111 0112 //! Sets the parameters of the fillet 0113 //! along the contour of index IC generated using the Add function 0114 //! in the internal data structure of this algorithm, where the radius of the 0115 //! fillet evolves according to a linear evolution law defined 0116 //! from R1 to R2, between the first and last vertices of the contour of index IC. 0117 Standard_EXPORT void SetRadius (const Standard_Real R1, const Standard_Real R2, const Standard_Integer IC, const Standard_Integer IinC); 0118 0119 //! Sets the parameters of the fillet 0120 //! along the contour of index IC generated using the Add function 0121 //! in the internal data structure of this algorithm, where the radius of the 0122 //! fillet evolves according to the evolution law L, between the 0123 //! first and last vertices of the contour of index IC. 0124 Standard_EXPORT void SetRadius (const Handle(Law_Function)& L, const Standard_Integer IC, const Standard_Integer IinC); 0125 0126 //! Sets the parameters of the fillet 0127 //! along the contour of index IC generated using the Add function 0128 //! in the internal data structure of this algorithm, 0129 //! where the radius of the fillet evolves according to the evolution law 0130 //! which interpolates the set of parameter and radius pairs given 0131 //! in the array UandR as follows: 0132 //! - the X coordinate of a point in UandR defines a 0133 //! relative parameter on the contour (i.e. a parameter between 0 and 1), 0134 //! - the Y coordinate of a point in UandR gives the 0135 //! corresponding value of the radius, and the radius evolves 0136 //! between the first and last vertices of the contour of index IC. 0137 Standard_EXPORT void SetRadius (const TColgp_Array1OfPnt2d& UandR, const Standard_Integer IC, const Standard_Integer IinC); 0138 0139 //! Erases the radius information on the contour of index 0140 //! IC in the internal data structure of this algorithm. 0141 //! Use the SetRadius function to reset this data. 0142 //! Warning 0143 //! Nothing is done if IC is outside the bounds of the table of contours. 0144 Standard_EXPORT void ResetContour (const Standard_Integer IC) Standard_OVERRIDE; 0145 0146 //! Returns true if the radius of the fillet along the contour of index IC 0147 //! in the internal data structure of this algorithm is constant, 0148 //! Warning 0149 //! False is returned if IC is outside the bounds of the table 0150 //! of contours or if E does not belong to the contour of index IC. 0151 Standard_EXPORT Standard_Boolean IsConstant (const Standard_Integer IC); 0152 0153 //! Returns the radius of the fillet along the contour of index IC in the 0154 //! internal data structure of this algorithm 0155 //! Warning 0156 //! - Use this function only if the radius is constant. 0157 //! - -1. is returned if IC is outside the bounds of the 0158 //! table of contours or if E does not belong to the contour of index IC. 0159 Standard_EXPORT Standard_Real Radius (const Standard_Integer IC); 0160 0161 //! Returns true if the radius of the fillet along the edge E of the 0162 //! contour of index IC in the internal data structure of 0163 //! this algorithm is constant. 0164 //! Warning 0165 //! False is returned if IC is outside the bounds of the table 0166 //! of contours or if E does not belong to the contour of index IC. 0167 Standard_EXPORT Standard_Boolean IsConstant (const Standard_Integer IC, const TopoDS_Edge& E); 0168 0169 //! Returns the radius of the fillet along the edge E of the contour of index 0170 //! IC in the internal data structure of this algorithm. 0171 //! Warning 0172 //! - Use this function only if the radius is constant. 0173 //! - -1 is returned if IC is outside the bounds of the 0174 //! table of contours or if E does not belong to the contour of index IC. 0175 Standard_EXPORT Standard_Real Radius (const Standard_Integer IC, const TopoDS_Edge& E); 0176 0177 //! Assigns Radius as the radius of the fillet on the edge E 0178 Standard_EXPORT void SetRadius (const Standard_Real Radius, const Standard_Integer IC, const TopoDS_Edge& E); 0179 0180 Standard_EXPORT void SetRadius (const Standard_Real Radius, const Standard_Integer IC, const TopoDS_Vertex& V); 0181 0182 Standard_EXPORT Standard_Boolean GetBounds (const Standard_Integer IC, const TopoDS_Edge& E, Standard_Real& F, Standard_Real& L); 0183 0184 Standard_EXPORT Handle(Law_Function) GetLaw (const Standard_Integer IC, const TopoDS_Edge& E); 0185 0186 Standard_EXPORT void SetLaw (const Standard_Integer IC, const TopoDS_Edge& E, const Handle(Law_Function)& L); 0187 0188 //! Assigns FShape as the type of fillet shape built by this algorithm. 0189 Standard_EXPORT void SetFilletShape (const ChFi3d_FilletShape FShape); 0190 0191 //! Returns the type of fillet shape built by this algorithm. 0192 Standard_EXPORT ChFi3d_FilletShape GetFilletShape() const; 0193 0194 //! Returns the number of contours generated using the 0195 //! Add function in the internal data structure of this algorithm. 0196 Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE; 0197 0198 //! Returns the index of the contour in the internal data 0199 //! structure of this algorithm which contains the edge E of the shape. 0200 //! This function returns 0 if the edge E does not belong to any contour. 0201 //! Warning 0202 //! This index can change if a contour is removed from the 0203 //! internal data structure of this algorithm using the function Remove. 0204 Standard_EXPORT Standard_Integer Contour (const TopoDS_Edge& E) const Standard_OVERRIDE; 0205 0206 //! Returns the number of edges in the contour of index I in 0207 //! the internal data structure of this algorithm. 0208 //! Warning 0209 //! Returns 0 if I is outside the bounds of the table of contours. 0210 Standard_EXPORT Standard_Integer NbEdges (const Standard_Integer I) const Standard_OVERRIDE; 0211 0212 //! Returns the edge of index J in the contour of index I in 0213 //! the internal data structure of this algorithm. 0214 //! Warning 0215 //! Returns a null shape if: 0216 //! - I is outside the bounds of the table of contours, or 0217 //! - J is outside the bounds of the table of edges of the index I contour. 0218 Standard_EXPORT const TopoDS_Edge& Edge (const Standard_Integer I, const Standard_Integer J) const Standard_OVERRIDE; 0219 0220 //! Removes the contour in the internal data structure of 0221 //! this algorithm which contains the edge E of the shape. 0222 //! Warning 0223 //! Nothing is done if the edge E does not belong to the 0224 //! contour in the internal data structure of this algorithm. 0225 Standard_EXPORT void Remove (const TopoDS_Edge& E) Standard_OVERRIDE; 0226 0227 //! Returns the length of the contour of index IC in the 0228 //! internal data structure of this algorithm. 0229 //! Warning 0230 //! Returns -1. if IC is outside the bounds of the table of contours. 0231 Standard_EXPORT Standard_Real Length (const Standard_Integer IC) const Standard_OVERRIDE; 0232 0233 //! Returns the first vertex of the contour of index IC 0234 //! in the internal data structure of this algorithm. 0235 //! Warning 0236 //! Returns a null shape if IC is outside the bounds of the table of contours. 0237 Standard_EXPORT TopoDS_Vertex FirstVertex (const Standard_Integer IC) const Standard_OVERRIDE; 0238 0239 //! Returns the last vertex of the contour of index IC 0240 //! in the internal data structure of this algorithm. 0241 //! Warning 0242 //! Returns a null shape if IC is outside the bounds of the table of contours. 0243 Standard_EXPORT TopoDS_Vertex LastVertex (const Standard_Integer IC) const Standard_OVERRIDE; 0244 0245 //! Returns the curvilinear abscissa of the vertex V on the 0246 //! contour of index IC in the internal data structure of this algorithm. 0247 //! Warning 0248 //! Returns -1. if: 0249 //! - IC is outside the bounds of the table of contours, or 0250 //! - V is not on the contour of index IC. 0251 Standard_EXPORT Standard_Real Abscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE; 0252 0253 //! Returns the relative curvilinear abscissa (i.e. between 0 0254 //! and 1) of the vertex V on the contour of index IC in the 0255 //! internal data structure of this algorithm. 0256 //! Warning 0257 //! Returns -1. if: 0258 //! - IC is outside the bounds of the table of contours, or 0259 //! - V is not on the contour of index IC. 0260 Standard_EXPORT Standard_Real RelativeAbscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const Standard_OVERRIDE; 0261 0262 //! Returns true if the contour of index IC in the internal 0263 //! data structure of this algorithm is closed and tangential 0264 //! at the point of closure. 0265 //! Warning 0266 //! Returns false if IC is outside the bounds of the table of contours. 0267 Standard_EXPORT Standard_Boolean ClosedAndTangent (const Standard_Integer IC) const Standard_OVERRIDE; 0268 0269 //! Returns true if the contour of index IC in the internal 0270 //! data structure of this algorithm is closed. 0271 //! Warning 0272 //! Returns false if IC is outside the bounds of the table of contours. 0273 Standard_EXPORT Standard_Boolean Closed (const Standard_Integer IC) const Standard_OVERRIDE; 0274 0275 //! Builds the fillets on all the contours in the internal data 0276 //! structure of this algorithm and constructs the resulting shape. 0277 //! Use the function IsDone to verify that the filleted shape 0278 //! is built. Use the function Shape to retrieve the filleted shape. 0279 //! Warning 0280 //! The construction of fillets implements highly complex 0281 //! construction algorithms. Consequently, there may be 0282 //! instances where the algorithm fails, for example if the 0283 //! data defining the radius of the fillet is not compatible 0284 //! with the geometry of the initial shape. There is no initial 0285 //! analysis of errors and they only become evident at the 0286 //! construction stage. 0287 //! Additionally, in the current software release, the 0288 //! following cases are not handled: 0289 //! - the end point of the contour is the point of 0290 //! intersection of 4 or more edges of the shape, or 0291 //! - the intersection of the fillet with a face which limits 0292 //! the contour is not fully contained in this face. 0293 Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; 0294 0295 //! Reinitializes this algorithm, thus canceling the effects of the Build function. 0296 //! This function allows modifications to be made to the 0297 //! contours and fillet parameters in order to rebuild the shape. 0298 Standard_EXPORT void Reset() Standard_OVERRIDE; 0299 0300 //! Returns the internal topology building algorithm. 0301 Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const; 0302 0303 //! Returns the list of shapes generated from the 0304 //! shape <EorV>. 0305 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& EorV) Standard_OVERRIDE; 0306 0307 //! Returns the list of shapes modified from the shape 0308 //! <F>. 0309 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& F) Standard_OVERRIDE; 0310 0311 Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& F) Standard_OVERRIDE; 0312 0313 //! returns the number of surfaces 0314 //! after the shape creation. 0315 Standard_EXPORT Standard_Integer NbSurfaces() const; 0316 0317 //! Return the faces created for surface <I>. 0318 Standard_EXPORT const TopTools_ListOfShape& NewFaces (const Standard_Integer I); 0319 0320 Standard_EXPORT void Simulate (const Standard_Integer IC) Standard_OVERRIDE; 0321 0322 Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const Standard_OVERRIDE; 0323 0324 Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC, const Standard_Integer IS) const Standard_OVERRIDE; 0325 0326 //! Returns the number of contours where the computation 0327 //! of the fillet failed 0328 Standard_EXPORT Standard_Integer NbFaultyContours() const; 0329 0330 //! for each I in [1.. NbFaultyContours] returns the index IC of 0331 //! the contour where the computation of the fillet failed. 0332 //! the method NbEdges(IC) gives the number of edges in the contour IC 0333 //! the method Edge(IC,ie) gives the edge number ie of the contour IC 0334 Standard_EXPORT Standard_Integer FaultyContour (const Standard_Integer I) const; 0335 0336 //! returns the number of surfaces which have been 0337 //! computed on the contour IC 0338 Standard_EXPORT Standard_Integer NbComputedSurfaces (const Standard_Integer IC) const; 0339 0340 //! returns the surface number IS concerning the contour IC 0341 Standard_EXPORT Handle(Geom_Surface) ComputedSurface (const Standard_Integer IC, const Standard_Integer IS) const; 0342 0343 //! returns the number of vertices where the computation failed 0344 Standard_EXPORT Standard_Integer NbFaultyVertices() const; 0345 0346 //! returns the vertex where the computation failed 0347 Standard_EXPORT TopoDS_Vertex FaultyVertex (const Standard_Integer IV) const; 0348 0349 //! returns true if a part of the result has been computed 0350 //! if the filling in a corner failed a shape with a hole is returned 0351 Standard_EXPORT Standard_Boolean HasResult() const; 0352 0353 //! if (HasResult()) returns the partial result 0354 Standard_EXPORT TopoDS_Shape BadShape() const; 0355 0356 //! returns the status concerning the contour IC in case of error 0357 //! ChFiDS_Ok : the computation is Ok 0358 //! ChFiDS_StartsolFailure : the computation can't start, perhaps the 0359 //! the radius is too big 0360 //! ChFiDS_TwistedSurface : the computation failed because of a twisted 0361 //! surface 0362 //! ChFiDS_WalkingFailure : there is a problem in the walking 0363 //! ChFiDS_Error: other error different from above 0364 Standard_EXPORT ChFiDS_ErrorStatus StripeStatus (const Standard_Integer IC) const; 0365 0366 0367 0368 0369 protected: 0370 0371 0372 0373 0374 0375 private: 0376 0377 0378 0379 ChFi3d_FilBuilder myBuilder; 0380 TopTools_MapOfShape myMap; 0381 0382 0383 }; 0384 0385 0386 0387 0388 0389 0390 0391 #endif // _BRepFilletAPI_MakeFillet_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |