Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:18:56

0001 // Created on: 1998-06-03
0002 // Created by: data exchange team
0003 // Copyright (c) 1998-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _ShapeFix_Solid_HeaderFile
0018 #define _ShapeFix_Solid_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <ShapeFix_Root.hxx>
0026 #include <ShapeExtend_Status.hxx>
0027 class ShapeFix_Shell;
0028 class TopoDS_Solid;
0029 class TopoDS_Shell;
0030 class ShapeExtend_BasicMsgRegistrator;
0031 
0032 // resolve name collisions with X11 headers
0033 #ifdef Status
0034   #undef Status
0035 #endif
0036 
0037 //! Provides method to build a solid from a shells and
0038 //! orients them in order to have a valid solid with finite volume
0039 class ShapeFix_Solid : public ShapeFix_Root
0040 {
0041 
0042 public:
0043   //! Empty constructor;
0044   Standard_EXPORT ShapeFix_Solid();
0045 
0046   //! Initializes by solid.
0047   Standard_EXPORT ShapeFix_Solid(const TopoDS_Solid& solid);
0048 
0049   //! Initializes by solid .
0050   Standard_EXPORT virtual void Init(const TopoDS_Solid& solid);
0051 
0052   //! Iterates on shells and performs fixes
0053   //! (calls ShapeFix_Shell for each subshell). The passed
0054   //! progress indicator allows user to consult the current
0055   //! progress stage and abort algorithm if needed.
0056   Standard_EXPORT virtual bool Perform(
0057     const Message_ProgressRange& theProgress = Message_ProgressRange());
0058 
0059   //! Calls MakeSolid and orients the solid to be "not infinite"
0060   Standard_EXPORT TopoDS_Solid SolidFromShell(const TopoDS_Shell& shell);
0061 
0062   //! Returns the status of the last Fix.
0063   Standard_EXPORT bool Status(const ShapeExtend_Status status) const;
0064 
0065   //! Returns resulting solid.
0066   Standard_EXPORT TopoDS_Shape Solid() const;
0067 
0068   //! Returns tool for fixing shells.
0069   occ::handle<ShapeFix_Shell> FixShellTool() const { return myFixShell; }
0070 
0071   //! Sets message registrator
0072   Standard_EXPORT void SetMsgRegistrator(
0073     const occ::handle<ShapeExtend_BasicMsgRegistrator>& msgreg) override;
0074 
0075   //! Sets basic precision value (also to FixShellTool)
0076   Standard_EXPORT void SetPrecision(const double preci) override;
0077 
0078   //! Sets minimal allowed tolerance (also to FixShellTool)
0079   Standard_EXPORT void SetMinTolerance(const double mintol) override;
0080 
0081   //! Sets maximal allowed tolerance (also to FixShellTool)
0082   Standard_EXPORT void SetMaxTolerance(const double maxtol) override;
0083 
0084   //! Returns (modifiable) the mode for applying fixes of
0085   //! ShapeFix_Shell, by default True.
0086   int& FixShellMode() { return myFixShellMode; }
0087 
0088   //! Returns (modifiable) the mode for applying analysis and fixes of
0089   //! orientation of shells in the solid; by default True.
0090   int& FixShellOrientationMode() { return myFixShellOrientationMode; }
0091 
0092   //! Returns (modifiable) the mode for creation of solids.
0093   //! If mode myCreateOpenSolidMode is equal to true
0094   //! solids are created from open shells
0095   //! else solids are created from closed shells only.
0096   //! ShapeFix_Shell, by default False.
0097   bool& CreateOpenSolidMode() { return myCreateOpenSolidMode; }
0098 
0099   //! In case of multiconnexity returns compound of fixed solids
0100   //! else returns one solid.
0101   Standard_EXPORT TopoDS_Shape Shape();
0102 
0103   DEFINE_STANDARD_RTTIEXT(ShapeFix_Solid, ShapeFix_Root)
0104 
0105 protected:
0106   TopoDS_Shape                mySolid;
0107   occ::handle<ShapeFix_Shell> myFixShell;
0108   int                         myStatus;
0109   int                         myFixShellMode;
0110   int                         myFixShellOrientationMode;
0111   bool                        myCreateOpenSolidMode;
0112 };
0113 
0114 #endif // _ShapeFix_Solid_HeaderFile