|
|
|||
File indexing completed on 2026-12-02 10:10:15
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 <Bnd_Box.hxx> 0028 #include <TopoDS_Shape.hxx> 0029 #include <TopTools_ShapeMapHasher.hxx> 0030 #include <NCollection_DataMap.hxx> 0031 0032 //! Solid Builder is the algorithm for building solids from set of faces. 0033 //! The given faces should be non-intersecting, i.e. all coinciding parts 0034 //! of the faces should be shared among them. 0035 //! 0036 //! The algorithm performs the following steps to build the solids: 0037 //! 1. Find: 0038 //! - faces orientated INTERNAL; 0039 //! - alone faces given twice with different orientation; 0040 //! 2. Build all possible closed shells from the rest of the faces 0041 //! (*BOPAlgo_ShellSplitter* is used for that); 0042 //! 3. Classify the obtained shells on the Holes and Growths; 0043 //! 4. Build solids from the Growth shells, put Hole shells into closest Growth solids; 0044 //! 5. Classify all unused faces relatively created solids and put them as internal 0045 //! shells into the closest solids; 0046 //! 6. Find all unclassified faces, i.e. faces outside of all created solids, 0047 //! make internal shells from them and put these shells into a warning. 0048 //! 0049 //! It is possible to avoid all internal shells in the resulting solids. 0050 //! For that it is necessary to use the method SetAvoidInternalShapes(true) 0051 //! of the base class. In this case the steps 5 and 6 will not be performed at all. 0052 //! 0053 //! The algorithm may return the following warnings: 0054 //! - *BOPAlgo_AlertShellSplitterFailed* in case the ShellSplitter algorithm has failed; 0055 //! - *BOPAlgo_AlertSolidBuilderUnusedFaces* in case there are some faces outside of 0056 //! created solids left. 0057 //! 0058 //! Example of usage of the algorithm: 0059 //! ~~~~ 0060 //! const NCollection_List<TopoDS_Shape>& aFaces = ...; // Faces to build the solids 0061 //! bool isAvoidInternals = ...; // Flag which defines whether to create the 0062 //! internal shells or not BOPAlgo_BuilderSolid aBS; // Solid Builder tool 0063 //! aBS.SetShapes(aFaces); // Set the faces 0064 //! aBS.SetAvoidInternalShapes(isAvoidInternals); // Set the AvoidInternalShapesFlag 0065 //! aBS.Perform(); // Perform the operation 0066 //! if (!aBS.IsDone()) // Check for the errors 0067 //! { 0068 //! // error treatment 0069 //! Standard_SStream aSStream; 0070 //! aBS.DumpErrors(aSStream); 0071 //! return; 0072 //! } 0073 //! if (aBS.HasWarnings()) // Check for the warnings 0074 //! { 0075 //! // warnings treatment 0076 //! Standard_SStream aSStream; 0077 //! aBS.DumpWarnings(aSStream); 0078 //! } 0079 //! 0080 //! const NCollection_List<TopoDS_Shape>& aSolids = aBS.Areas(); // Obtaining the result solids 0081 //! ~~~~ 0082 //! 0083 class BOPAlgo_BuilderSolid : public BOPAlgo_BuilderArea 0084 { 0085 public: 0086 DEFINE_STANDARD_ALLOC 0087 0088 public: //! @name Constructors 0089 //! Empty constructor 0090 Standard_EXPORT BOPAlgo_BuilderSolid(); 0091 Standard_EXPORT ~BOPAlgo_BuilderSolid() override; 0092 0093 //! Constructor with allocator 0094 Standard_EXPORT BOPAlgo_BuilderSolid(const occ::handle<NCollection_BaseAllocator>& theAllocator); 0095 0096 public: //! @name Performing the operation 0097 //! Performs the construction of the solids from the given faces 0098 Standard_EXPORT void Perform( 0099 const Message_ProgressRange& theRange = Message_ProgressRange()) override; 0100 0101 public: //! @name Getting the bounding boxes of the created solids 0102 //! For classification purposes the algorithm builds the bounding boxes 0103 //! for all created solids. This method returns the data map of solid - box pairs. 0104 const NCollection_DataMap<TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher>& GetBoxesMap() const 0105 { 0106 return myBoxes; 0107 } 0108 0109 protected: //! @name Protected methods performing the operation 0110 //! Collect the faces: 0111 //! - with INTERNAL orientation; 0112 //! - that are alone but given twice with different orientation. 0113 //! These faces will be put into the map *myShapesToAvoid* and will be 0114 //! avoided in shells construction, but will be classified later on. 0115 Standard_EXPORT void PerformShapesToAvoid(const Message_ProgressRange& theRange) override; 0116 0117 //! Build all possible closed shells from the given faces. 0118 //! The method fills the following maps: 0119 //! - myLoops - Created closed shells; 0120 //! - myLoopsInternal - The shells created from unused faces. 0121 Standard_EXPORT void PerformLoops(const Message_ProgressRange& theRange) override; 0122 0123 //! Classifies the created shells on the Holes and Growths. 0124 //! Creates the solids from the Growths shells. 0125 //! Puts the Hole shells into the closest Growths solids. 0126 Standard_EXPORT void PerformAreas(const Message_ProgressRange& theRange) override; 0127 0128 //! Classifies the unused faces relatively the created solids. 0129 //! Puts the classified faces into the closest solids as internal shells. 0130 //! Warns the user about unclassified faces if any. 0131 Standard_EXPORT void PerformInternalShapes(const Message_ProgressRange& theRange) override; 0132 0133 private: 0134 NCollection_DataMap<TopoDS_Shape, Bnd_Box, TopTools_ShapeMapHasher> 0135 myBoxes; // Boxes of the produced solids 0136 }; 0137 0138 #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 |
|