Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:13:53

0001 // Created on: 2018-03-14
0002 // Created by: Nikolai BUKHALOV
0003 // Copyright (c) 1999-2018 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BRepFill_AdvancedEvolved_HeaderFile
0017 #define _BRepFill_AdvancedEvolved_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <TopoDS_Compound.hxx>
0024 #include <TopoDS_Wire.hxx>
0025 #include <TopTools_ShapeMapHasher.hxx>
0026 #include <NCollection_IndexedMap.hxx>
0027 #include <TopoDS_Shape.hxx>
0028 #include <NCollection_List.hxx>
0029 
0030 class BOPAlgo_MakerVolume;
0031 class TopoDS_Face;
0032 
0033 //! Constructs an evolved volume from a spine (wire or face)
0034 //! and a profile (wire).
0035 class BRepFill_AdvancedEvolved
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC;
0039 
0040   //! Constructor
0041   Standard_EXPORT BRepFill_AdvancedEvolved()
0042       : myErrorStatus(BRepFill_AdvancedEvolved_Empty),
0043         myFuzzyValue(0.0),
0044         myIsParallel(true),
0045         myDebugShapesPath("C:\\Temp")
0046   {
0047   }
0048 
0049   Standard_EXPORT void Perform(const TopoDS_Wire& theSpine,
0050                                const TopoDS_Wire& theProfile,
0051                                const double       theTolerance,
0052                                const bool         theSolidReq = true);
0053 
0054   bool IsDone(unsigned int* theErrorCode = nullptr) const
0055   {
0056     if (theErrorCode)
0057       *theErrorCode = myErrorStatus;
0058 
0059     return (myErrorStatus == BRepFill_AdvancedEvolved_OK);
0060   }
0061 
0062   //! returns the resulting shape.
0063   const TopoDS_Shape& Shape() const { return myResult; }
0064 
0065   //! Sets directory where the debug shapes will be saved
0066   void SetTemporaryDirectory(const char* const thePath) { myDebugShapesPath = thePath; }
0067 
0068   //! Sets/Unsets computation in parallel mode
0069   void SetParallelMode(const bool theVal) { myIsParallel = theVal; }
0070 
0071 protected:
0072   Standard_EXPORT void PerformSweep();
0073 
0074   Standard_EXPORT void GetLids();
0075 
0076   Standard_EXPORT void BuildSolid();
0077 
0078   Standard_EXPORT void RemoveExcessSolids(const NCollection_List<TopoDS_Shape>& theLSplits,
0079                                           const TopoDS_Shape&                   theShape,
0080                                           NCollection_List<TopoDS_Shape>&       theArgsList,
0081                                           BOPAlgo_MakerVolume&                  theMV);
0082 
0083   Standard_EXPORT void ExtractOuterSolid(TopoDS_Shape&                   theShape,
0084                                          NCollection_List<TopoDS_Shape>& theArgsList);
0085 
0086   Standard_EXPORT void GetSpineAndProfile(const TopoDS_Wire& theSpine,
0087                                           const TopoDS_Wire& theProfile);
0088 
0089   Standard_EXPORT void UnifyShape();
0090 
0091   Standard_EXPORT bool PerformBoolean(const NCollection_List<TopoDS_Shape>& theArgsList,
0092                                       TopoDS_Shape&                         theResult) const;
0093 
0094   Standard_EXPORT bool CheckSingularityAndAdd(
0095     const TopoDS_Face&              theF,
0096     const double                    theFuzzyToler,
0097     NCollection_List<TopoDS_Shape>& theListOfFaces,
0098     NCollection_List<TopoDS_Shape>& theListOfSplits) const;
0099 
0100   Standard_EXPORT bool IsLid(
0101     const TopoDS_Face&                                                   theF,
0102     const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapOfLids) const;
0103 
0104 private:
0105   enum
0106   {
0107     BRepFill_AdvancedEvolved_Empty = 0,
0108     BRepFill_AdvancedEvolved_NotPlanarSpine,
0109     BRepFill_AdvancedEvolved_SweepError,
0110     BRepFill_AdvancedEvolved_NoLids,
0111     BRepFill_AdvancedEvolved_NotSolid,
0112     BRepFill_AdvancedEvolved_NotVolume,
0113     BRepFill_AdvancedEvolved_OK = UINT_MAX
0114   } myErrorStatus;
0115 
0116   TopoDS_Wire     mySpine;
0117   TopoDS_Wire     myProfile;
0118   TopoDS_Shape    myPipeShell;
0119   TopoDS_Compound myTopBottom; // Lids can be split on several faces
0120   TopoDS_Shape    myResult;
0121   double          myFuzzyValue;
0122   bool            myIsParallel;
0123   const char*     myDebugShapesPath;
0124 };
0125 
0126 #endif // _BRepFill_AdvancedEvolved_HeaderFile