|
|
|||
Warning, file /include/opencascade/BOPAlgo_MakerVolume.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // Created by: Eugeny MALTCHIKOV 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 _BOPAlgo_MakerVolume_HeaderFile 0016 #define _BOPAlgo_MakerVolume_HeaderFile 0017 0018 #include <Standard.hxx> 0019 #include <Standard_DefineAlloc.hxx> 0020 #include <Standard_Handle.hxx> 0021 0022 #include <BOPAlgo_Builder.hxx> 0023 #include <Bnd_Box.hxx> 0024 #include <NCollection_BaseAllocator.hxx> 0025 #include <TopoDS_Solid.hxx> 0026 #include <TopoDS_Shape.hxx> 0027 #include <NCollection_List.hxx> 0028 #include <TopTools_ShapeMapHasher.hxx> 0029 #include <NCollection_Map.hxx> 0030 class BOPAlgo_PaveFiller; 0031 0032 //! The algorithm is to build solids from set of shapes. 0033 //! It uses the BOPAlgo_Builder algorithm to intersect the given shapes 0034 //! and build the images of faces (if needed) and BOPAlgo_BuilderSolid 0035 //! algorithm to build the solids. 0036 //! 0037 //! Steps of the algorithm: 0038 //! 1. Collect all faces: intersect the shapes if necessary and collect 0039 //! the images of faces, otherwise just collect the faces to the 0040 //! <myFaces> list; 0041 //! All faces on this step added twice, with orientation FORWARD 0042 //! and REVERSED; 0043 //! 0044 //! 2. Create bounding box covering all the faces from <myFaces> and 0045 //! create solid box from corner points of that bounding box 0046 //! (myBBox, mySBox). Add faces from that box to <myFaces>; 0047 //! 0048 //! 3. Build solids from <myFaces> using BOPAlgo_BuilderSolid algorithm; 0049 //! 0050 //! 4. Treat the result: Eliminate solid containing faces from <mySBox>; 0051 //! 0052 //! 5. Fill internal shapes: add internal vertices and edges into 0053 //! created solids; 0054 //! 0055 //! 6. Prepare the history. 0056 //! 0057 //! Fields: 0058 //! <myIntersect> - boolean flag. It defines whether intersect shapes 0059 //! from <myArguments> (if set to TRUE) or not (FALSE). 0060 //! The default value is TRUE. By setting it to FALSE 0061 //! the user should guarantee that shapes in <myArguments> 0062 //! do not interfere with each other, otherwise the result 0063 //! is unpredictable. 0064 //! 0065 //! <myBBox> - bounding box, covering all faces from <myFaces>. 0066 //! 0067 //! <mySBox> - Solid box created from the corner points of <myBBox>. 0068 //! 0069 //! <myFaces> - the list is to keep the "final" faces, that will be 0070 //! given to the BOPAlgo_BuilderSolid algorithm. 0071 //! If the shapes have been interfered it should contain 0072 //! the images of the source shapes, otherwise its just 0073 //! the original faces. 0074 //! It also contains the faces from <mySBox>. 0075 //! 0076 //! Fields inherited from BOPAlgo_Builder: 0077 //! 0078 //! <myArguments> - list of the source shapes. The source shapes can have 0079 //! any type, but each shape must not be self-interfered. 0080 //! 0081 //! <myShape> - Result shape: 0082 //! - empty compound - if no solids were created; 0083 //! - solid - if created only one solid; 0084 //! - compound of solids - if created more than one solid. 0085 //! 0086 //! Fields inherited from BOPAlgo_Algo: 0087 //! 0088 //! <myRunParallel> - Defines whether the parallel processing is 0089 //! switched on or not. 0090 //! <myReport> - Error status of the operation. Additionally to the 0091 //! errors of the parent algorithm it can have the following values: 0092 //! - *BOPAlgo_AlertSolidBuilderFailed* - BOPAlgo_BuilderSolid algorithm has failed. 0093 //! 0094 //! Example: 0095 //! 0096 //! BOPAlgo_MakerVolume aMV; 0097 //! // 0098 //! aMV.SetArguments(aLS); //source shapes 0099 //! aMV.SetRunParallel(bRunParallel); //parallel or single mode 0100 //! aMV.SetIntersect(bIntersect); //intersect or not the shapes from <aLS> 0101 //! // 0102 //! aMV.Perform(); //perform the operation 0103 //! if (aMV.HasErrors()) { //check error status 0104 //! return; 0105 //! } 0106 //! // 0107 //! const TopoDS_Shape& aResult = aMV.Shape(); //result of the operation 0108 class BOPAlgo_MakerVolume : public BOPAlgo_Builder 0109 { 0110 public: 0111 DEFINE_STANDARD_ALLOC 0112 0113 //! Empty constructor. 0114 BOPAlgo_MakerVolume(); 0115 ~BOPAlgo_MakerVolume() override; 0116 0117 //! Empty constructor. 0118 BOPAlgo_MakerVolume(const occ::handle<NCollection_BaseAllocator>& theAllocator); 0119 0120 //! Clears the data. 0121 void Clear() override; 0122 0123 //! Sets the flag myIntersect: 0124 //! if <bIntersect> is TRUE the shapes from <myArguments> will be intersected. 0125 //! if <bIntersect> is FALSE no intersection will be done. 0126 void SetIntersect(const bool bIntersect); 0127 0128 //! Returns the flag <myIntersect>. 0129 bool IsIntersect() const; 0130 0131 //! Returns the solid box <mySBox>. 0132 const TopoDS_Solid& Box() const; 0133 0134 //! Returns the processed faces <myFaces>. 0135 const NCollection_List<TopoDS_Shape>& Faces() const; 0136 0137 //! Defines the preventing of addition of internal for solid parts into the result. 0138 //! By default the internal parts are added into result. 0139 void SetAvoidInternalShapes(const bool theAvoidInternal) 0140 { 0141 myAvoidInternalShapes = theAvoidInternal; 0142 } 0143 0144 //! Returns the AvoidInternalShapes flag 0145 bool IsAvoidInternalShapes() const { return myAvoidInternalShapes; } 0146 0147 //! Performs the operation. 0148 Standard_EXPORT void Perform( 0149 const Message_ProgressRange& theRange = Message_ProgressRange()) override; 0150 0151 protected: 0152 //! Checks the data. 0153 Standard_EXPORT void CheckData() override; 0154 0155 //! Performs the operation. 0156 Standard_EXPORT void PerformInternal1( 0157 const BOPAlgo_PaveFiller& thePF, 0158 const Message_ProgressRange& theRange = Message_ProgressRange()) override; 0159 0160 //! Collects all faces. 0161 Standard_EXPORT void CollectFaces(); 0162 0163 //! Makes solid box. 0164 Standard_EXPORT void MakeBox(NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& theBoxFaces); 0165 0166 //! Builds solids. 0167 Standard_EXPORT void BuildSolids(NCollection_List<TopoDS_Shape>& theLSR, 0168 const Message_ProgressRange& theRange); 0169 0170 //! Removes the covering box. 0171 Standard_EXPORT void RemoveBox( 0172 NCollection_List<TopoDS_Shape>& theLSR, 0173 const NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& theBoxFaces); 0174 0175 //! Fills the solids with internal shapes. 0176 Standard_EXPORT void FillInternalShapes(const NCollection_List<TopoDS_Shape>& theLSR); 0177 0178 //! Builds the result. 0179 Standard_EXPORT void BuildShape(const NCollection_List<TopoDS_Shape>& theLSR); 0180 0181 protected: 0182 //! List of operations to be supported by the Progress Indicator. 0183 //! Enumeration is going to contain some extra operations from base class, 0184 //! which are not going to be used here. So, the array of steps will also 0185 //! contain some extra zero values. This is the only extra resource that is 0186 //! going to be used, but it allows us not to override the methods that use 0187 //! the values of the enumeration of base class. 0188 //! Starting the enumeration from the middle of enumeration of base class is 0189 //! not a good idea as the values in enumeration may be swapped. 0190 enum BOPAlgo_PIOperation 0191 { 0192 PIOperation_BuildSolids = BOPAlgo_Builder::PIOperation_Last, 0193 PIOperation_Last 0194 }; 0195 0196 //! Analyze progress steps 0197 Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const override; 0198 0199 protected: 0200 bool myIntersect; 0201 Bnd_Box myBBox; 0202 TopoDS_Solid mySBox; 0203 NCollection_List<TopoDS_Shape> myFaces; 0204 bool myAvoidInternalShapes; 0205 }; 0206 0207 #include <BOPAlgo_MakerVolume.lxx> 0208 0209 #endif // _BOPAlgo_MakerVolume_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|