|
|
|||
File indexing completed on 2026-06-13 08:29:45
0001 // Created by: Peter KURNEV 0002 // Copyright (c) 2010-2014 OPEN CASCADE SAS 0003 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE 0004 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, 0005 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 0006 // 0007 // This file is part of Open CASCADE Technology software library. 0008 // 0009 // This library is free software; you can redistribute it and/or modify it under 0010 // the terms of the GNU Lesser General Public License version 2.1 as published 0011 // by the Free Software Foundation, with special exception defined in the file 0012 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0013 // distribution for complete text of the license and disclaimer of any warranty. 0014 // 0015 // Alternatively, this file may be used under the terms of Open CASCADE 0016 // commercial license or contractual agreement. 0017 0018 #ifndef _BOPAlgo_BuilderSolid_HeaderFile 0019 #define _BOPAlgo_BuilderSolid_HeaderFile 0020 0021 #include <Standard.hxx> 0022 #include <Standard_DefineAlloc.hxx> 0023 #include <Standard_Handle.hxx> 0024 0025 #include <BOPAlgo_BuilderArea.hxx> 0026 #include <NCollection_BaseAllocator.hxx> 0027 #include <TopTools_DataMapOfShapeBox.hxx> 0028 0029 //! Solid Builder is the algorithm for building solids from set of faces. 0030 //! The given faces should be non-intersecting, i.e. all coinciding parts 0031 //! of the faces should be shared among them. 0032 //! 0033 //! The algorithm performs the following steps to build the solids: 0034 //! 1. Find: 0035 //! - faces orientated INTERNAL; 0036 //! - alone faces given twice with different orientation; 0037 //! 2. Build all possible closed shells from the rest of the faces 0038 //! (*BOPAlgo_ShellSplitter* is used for that); 0039 //! 3. Classify the obtained shells on the Holes and Growths; 0040 //! 4. Build solids from the Growth shells, put Hole shells into closest Growth solids; 0041 //! 5. Classify all unused faces relatively created solids and put them as internal 0042 //! shells into the closest solids; 0043 //! 6. Find all unclassified faces, i.e. faces outside of all created solids, 0044 //! make internal shells from them and put these shells into a warning. 0045 //! 0046 //! It is possible to avoid all internal shells in the resulting solids. 0047 //! For that it is necessary to use the method SetAvoidInternalShapes(true) 0048 //! of the base class. In this case the steps 5 and 6 will not be performed at all. 0049 //! 0050 //! The algorithm may return the following warnings: 0051 //! - *BOPAlgo_AlertShellSplitterFailed* in case the ShellSplitter algorithm has failed; 0052 //! - *BOPAlgo_AlertSolidBuilderUnusedFaces* in case there are some faces outside of 0053 //! created solids left. 0054 //! 0055 //! Example of usage of the algorithm: 0056 //! ~~~~ 0057 //! const TopTools_ListOfShape& aFaces = ...; // Faces to build the solids 0058 //! Standard_Boolean isAvoidInternals = ...; // Flag which defines whether to create the 0059 //! internal shells or not BOPAlgo_BuilderSolid aBS; // Solid Builder tool 0060 //! aBS.SetShapes(aFaces); // Set the faces 0061 //! aBS.SetAvoidInternalShapes(isAvoidInternals); // Set the AvoidInternalShapesFlag 0062 //! aBS.Perform(); // Perform the operation 0063 //! if (!aBS.IsDone()) // Check for the errors 0064 //! { 0065 //! // error treatment 0066 //! Standard_SStream aSStream; 0067 //! aBS.DumpErrors(aSStream); 0068 //! return; 0069 //! } 0070 //! if (aBS.HasWarnings()) // Check for the warnings 0071 //! { 0072 //! // warnings treatment 0073 //! Standard_SStream aSStream; 0074 //! aBS.DumpWarnings(aSStream); 0075 //! } 0076 //! 0077 //! const TopTools_ListOfShape& aSolids = aBS.Areas(); // Obtaining the result solids 0078 //! ~~~~ 0079 //! 0080 class BOPAlgo_BuilderSolid : public BOPAlgo_BuilderArea 0081 { 0082 public: 0083 DEFINE_STANDARD_ALLOC 0084 0085 public: //! @name Constructors 0086 //! Empty constructor 0087 Standard_EXPORT BOPAlgo_BuilderSolid(); 0088 Standard_EXPORT virtual ~BOPAlgo_BuilderSolid(); 0089 0090 //! Constructor with allocator 0091 Standard_EXPORT BOPAlgo_BuilderSolid(const Handle(NCollection_BaseAllocator)& theAllocator); 0092 0093 public: //! @name Performing the operation 0094 //! Performs the construction of the solids from the given faces 0095 Standard_EXPORT virtual void Perform( 0096 const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; 0097 0098 public: //! @name Getting the bounding boxes of the created solids 0099 //! For classification purposes the algorithm builds the bounding boxes 0100 //! for all created solids. This method returns the data map of solid - box pairs. 0101 const TopTools_DataMapOfShapeBox& GetBoxesMap() const { return myBoxes; } 0102 0103 protected: //! @name Protected methods performing the operation 0104 //! Collect the faces: 0105 //! - with INTERNAL orientation; 0106 //! - that are alone but given twice with different orientation. 0107 //! These faces will be put into the map *myShapesToAvoid* and will be 0108 //! avoided in shells construction, but will be classified later on. 0109 Standard_EXPORT virtual void PerformShapesToAvoid(const Message_ProgressRange& theRange) 0110 Standard_OVERRIDE; 0111 0112 //! Build all possible closed shells from the given faces. 0113 //! The method fills the following maps: 0114 //! - myLoops - Created closed shells; 0115 //! - myLoopsInternal - The shells created from unused faces. 0116 Standard_EXPORT virtual void PerformLoops(const Message_ProgressRange& theRange) 0117 Standard_OVERRIDE; 0118 0119 //! Classifies the created shells on the Holes and Growths. 0120 //! Creates the solids from the Growths shells. 0121 //! Puts the Hole shells into the closest Growths solids. 0122 Standard_EXPORT virtual void PerformAreas(const Message_ProgressRange& theRange) 0123 Standard_OVERRIDE; 0124 0125 //! Classifies the unused faces relatively the created solids. 0126 //! Puts the classified faces into the closest solids as internal shells. 0127 //! Warns the user about unclassified faces if any. 0128 Standard_EXPORT virtual void PerformInternalShapes(const Message_ProgressRange& theRange) 0129 Standard_OVERRIDE; 0130 0131 private: 0132 TopTools_DataMapOfShapeBox myBoxes; // Boxes of the produced solids 0133 }; 0134 0135 #endif // _BOPAlgo_BuilderSolid_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|