|
||||
File indexing completed on 2025-01-18 10:03:06
0001 // Created by: Peter KURNEV 0002 // Copyright (c) 2014 OPEN CASCADE SAS 0003 // 0004 // This file is part of Open CASCADE Technology software library. 0005 // 0006 // This library is free software; you can redistribute it and/or modify it under 0007 // the terms of the GNU Lesser General Public License version 2.1 as published 0008 // by the Free Software Foundation, with special exception defined in the file 0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0010 // distribution for complete text of the license and disclaimer of any warranty. 0011 // 0012 // Alternatively, this file may be used under the terms of Open CASCADE 0013 // commercial license or contractual agreement. 0014 0015 #ifndef _BRepAlgoAPI_BuilderAlgo_HeaderFile 0016 #define _BRepAlgoAPI_BuilderAlgo_HeaderFile 0017 0018 #include <Standard.hxx> 0019 #include <Standard_DefineAlloc.hxx> 0020 #include <Standard_Handle.hxx> 0021 0022 #include <BOPAlgo_GlueEnum.hxx> 0023 #include <BOPAlgo_PPaveFiller.hxx> 0024 #include <BOPAlgo_PBuilder.hxx> 0025 #include <BRepAlgoAPI_Algo.hxx> 0026 #include <BRepTools_History.hxx> 0027 #include <Precision.hxx> 0028 #include <Standard_Real.hxx> 0029 #include <TopTools_ListOfShape.hxx> 0030 0031 //! The class contains API level of the General Fuse algorithm.<br> 0032 //! 0033 //! Additionally to the options defined in the base class, the algorithm has 0034 //! the following options:<br> 0035 //! - *Safe processing mode* - allows to avoid modification of the input 0036 //! shapes during the operation (by default it is off); 0037 //! - *Gluing options* - allows to speed up the calculation of the intersections 0038 //! on the special cases, in which some sub-shapes are coinciding. 0039 //! - *Disabling the check for inverted solids* - Disables/Enables the check of the input solids 0040 //! for inverted status (holes in the space). The default value is TRUE, 0041 //! i.e. the check is performed. Setting this flag to FALSE for inverted solids, 0042 //! most likely will lead to incorrect results. 0043 //! - *Disabling history collection* - allows disabling the collection of the history 0044 //! of shapes modifications during the operation. 0045 //! 0046 //! It returns the following Error statuses:<br> 0047 //! - 0 - in case of success;<br> 0048 //! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to perform the operation;<br> 0049 //! - *BOPAlgo_AlertIntersectionFailed* - in case the intersection of the arguments has failed;<br> 0050 //! - *BOPAlgo_AlertBuilderFailed* - in case building of the result shape has failed.<br> 0051 //! 0052 //! Warnings statuses from underlying DS Filler and Builder algorithms 0053 //! are collected in the report. 0054 //! 0055 //! The class provides possibility to simplify the resulting shape by unification 0056 //! of the tangential edges and faces. It is performed by the method *SimplifyResult*. 0057 //! See description of this method for more details. 0058 //! 0059 class BRepAlgoAPI_BuilderAlgo : public BRepAlgoAPI_Algo 0060 { 0061 public: 0062 0063 DEFINE_STANDARD_ALLOC 0064 0065 0066 public: //! @name Constructors 0067 0068 //! Empty constructor 0069 Standard_EXPORT BRepAlgoAPI_BuilderAlgo(); 0070 Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo(); 0071 0072 //! Constructor with prepared Filler object 0073 Standard_EXPORT BRepAlgoAPI_BuilderAlgo(const BOPAlgo_PaveFiller& thePF); 0074 0075 0076 public: //! @name Setting/Getting data for the algorithm 0077 0078 //! Sets the arguments 0079 void SetArguments (const TopTools_ListOfShape& theLS) 0080 { 0081 myArguments = theLS; 0082 } 0083 0084 //! Gets the arguments 0085 const TopTools_ListOfShape& Arguments() const 0086 { 0087 return myArguments; 0088 } 0089 0090 0091 public: //! @name Setting options 0092 0093 //! Sets the flag that defines the mode of treatment. 0094 //! In non-destructive mode the argument shapes are not modified. Instead 0095 //! a copy of a sub-shape is created in the result if it is needed to be updated. 0096 void SetNonDestructive(const Standard_Boolean theFlag) 0097 { 0098 myNonDestructive = theFlag; 0099 } 0100 0101 //! Returns the flag that defines the mode of treatment. 0102 //! In non-destructive mode the argument shapes are not modified. Instead 0103 //! a copy of a sub-shape is created in the result if it is needed to be updated. 0104 Standard_Boolean NonDestructive() const 0105 { 0106 return myNonDestructive; 0107 } 0108 0109 //! Sets the glue option for the algorithm, 0110 //! which allows increasing performance of the intersection 0111 //! of the input shapes. 0112 void SetGlue(const BOPAlgo_GlueEnum theGlue) 0113 { 0114 myGlue = theGlue; 0115 } 0116 0117 //! Returns the glue option of the algorithm 0118 BOPAlgo_GlueEnum Glue() const 0119 { 0120 return myGlue; 0121 } 0122 0123 //! Enables/Disables the check of the input solids for inverted status 0124 void SetCheckInverted(const Standard_Boolean theCheck) 0125 { 0126 myCheckInverted = theCheck; 0127 } 0128 0129 //! Returns the flag defining whether the check for input solids on inverted status 0130 //! should be performed or not. 0131 Standard_Boolean CheckInverted() const 0132 { 0133 return myCheckInverted; 0134 } 0135 0136 0137 public: //! @name Performing the operation 0138 0139 //! Performs the algorithm 0140 Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; 0141 0142 0143 public: //! @name Result simplification 0144 0145 //! Simplification of the result shape is performed by the means of 0146 //! *ShapeUpgrade_UnifySameDomain* algorithm. The result of the operation will 0147 //! be overwritten with the simplified result. 0148 //! 0149 //! The simplification is performed without creation of the Internal shapes, 0150 //! i.e. shapes connections will never be broken. 0151 //! 0152 //! Simplification is performed on the whole result shape. Thus, if the input 0153 //! shapes contained connected tangent edges or faces unmodified during the operation 0154 //! they will also be unified. 0155 //! 0156 //! After simplification, the History of result simplification is merged into the main 0157 //! history of operation. So, it is taken into account when asking for Modified, 0158 //! Generated and Deleted shapes. 0159 //! 0160 //! Some options of the main operation are passed into the Unifier: 0161 //! - Fuzzy tolerance of the operation is given to the Unifier as the linear tolerance. 0162 //! - Non destructive mode here controls the safe input mode in Unifier. 0163 //! 0164 //! @param theUnifyEdges Controls the edges unification. TRUE by default. 0165 //! @param theUnifyFaces Controls the faces unification. TRUE by default. 0166 //! @param theAngularTol Angular criteria for tangency of edges and faces. 0167 //! Precision::Angular() by default. 0168 Standard_EXPORT void SimplifyResult(const Standard_Boolean theUnifyEdges = Standard_True, 0169 const Standard_Boolean theUnifyFaces = Standard_True, 0170 const Standard_Real theAngularTol = Precision::Angular()); 0171 0172 0173 public: //! @name History support 0174 0175 //! Returns the shapes modified from the shape <theS>. 0176 //! If any, the list will contain only those splits of the 0177 //! given shape, contained in the result. 0178 Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) Standard_OVERRIDE; 0179 0180 //! Returns the list of shapes generated from the shape <theS>. 0181 //! In frames of Boolean Operations algorithms only Edges and Faces 0182 //! could have Generated elements, as only they produce new elements 0183 //! during intersection: 0184 //! - Edges can generate new vertices; 0185 //! - Faces can generate new edges and vertices. 0186 Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) Standard_OVERRIDE; 0187 0188 //! Checks if the shape <theS> has been completely removed from the result, 0189 //! i.e. the result does not contain the shape itself and any of its splits. 0190 //! Returns TRUE if the shape has been deleted. 0191 Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& aS) Standard_OVERRIDE; 0192 0193 //! Returns true if any of the input shapes has been modified during operation. 0194 Standard_EXPORT virtual Standard_Boolean HasModified() const; 0195 0196 //! Returns true if any of the input shapes has generated shapes during operation. 0197 Standard_EXPORT virtual Standard_Boolean HasGenerated() const; 0198 0199 //! Returns true if any of the input shapes has been deleted during operation. 0200 //! Normally, General Fuse operation should not have Deleted elements, 0201 //! but all derived operation can have. 0202 Standard_EXPORT virtual Standard_Boolean HasDeleted() const; 0203 0204 0205 public: //! @name Enabling/Disabling the history collection. 0206 0207 //! Allows disabling the history collection 0208 void SetToFillHistory(const Standard_Boolean theHistFlag) { myFillHistory = theHistFlag; } 0209 0210 //! Returns flag of history availability 0211 Standard_Boolean HasHistory() const { return myFillHistory; } 0212 0213 0214 public: //! @name Getting the section edges 0215 0216 //! Returns a list of section edges. 0217 //! The edges represent the result of intersection between arguments of operation. 0218 Standard_EXPORT const TopTools_ListOfShape& SectionEdges(); 0219 0220 0221 public: //! @name Getting tools performing the job 0222 0223 //! Returns the Intersection tool 0224 const BOPAlgo_PPaveFiller& DSFiller() const 0225 { 0226 return myDSFiller; 0227 } 0228 0229 //! Returns the Building tool 0230 const BOPAlgo_PBuilder& Builder() const 0231 { 0232 return myBuilder; 0233 } 0234 0235 //! History tool 0236 Handle(BRepTools_History) History() const 0237 { 0238 return myFillHistory ? myHistory : NULL; 0239 } 0240 0241 0242 protected: //! @name Setting options to the Intersection tool 0243 0244 //! Sets options (available in child classes) for the intersection tool. 0245 //! Here it does nothing. 0246 virtual void SetAttributes() {} 0247 0248 0249 protected: //! @name Protected methods for shapes intersection and building result 0250 0251 //! Intersects the given shapes with the intersection tool 0252 Standard_EXPORT void IntersectShapes(const TopTools_ListOfShape& theArgs, const Message_ProgressRange& theRange); 0253 0254 //! Builds the resulting shape 0255 Standard_EXPORT void BuildResult(const Message_ProgressRange& theRange = Message_ProgressRange()); 0256 0257 0258 protected: //! @name Clearing the contents of the algorithm 0259 0260 //! Clears the algorithm from previous runs 0261 Standard_EXPORT virtual void Clear() Standard_OVERRIDE; 0262 0263 0264 protected: //! @name Fields 0265 0266 // Inputs 0267 TopTools_ListOfShape myArguments; //!< Arguments of the operation 0268 0269 // Options 0270 Standard_Boolean myNonDestructive; //!< Non-destructive mode management 0271 BOPAlgo_GlueEnum myGlue; //!< Gluing mode management 0272 Standard_Boolean myCheckInverted; //!< Check for inverted solids management 0273 Standard_Boolean myFillHistory; //!< Controls the history collection 0274 0275 // Tools 0276 Standard_Boolean myIsIntersectionNeeded; //!< Flag to control whether the intersection 0277 //! of arguments should be performed or not 0278 BOPAlgo_PPaveFiller myDSFiller; //!< Intersection tool performs intersection of the 0279 //! argument shapes. 0280 BOPAlgo_PBuilder myBuilder; //!< Building tool performs construction of the result 0281 //! basing on the results of intersection 0282 Handle(BRepTools_History) myHistory; //!< General History tool, containing all History of 0283 //! shapes modifications during the operation 0284 //! (including result simplification) 0285 Handle(BRepTools_History) mySimplifierHistory; //!< History of result shape simplification 0286 }; 0287 0288 #endif // _BRepAlgoAPI_BuilderAlgo_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |