1 // Created on: 1998-06-03
2 // Created by: data exchange team
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _ShapeFix_Solid_HeaderFile
18 #define _ShapeFix_Solid_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TopoDS_Shape.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <ShapeFix_Root.hxx>
27 #include <ShapeExtend_Status.hxx>
28 #include <Standard_Real.hxx>
31 class Message_ProgressScope;
33 class ShapeExtend_BasicMsgRegistrator;
35 // resolve name collisions with X11 headers
41 DEFINE_STANDARD_HANDLE(ShapeFix_Solid, ShapeFix_Root)
43 //! Provides method to build a solid from a shells and
44 //! orients them in order to have a valid solid with finite volume
45 class ShapeFix_Solid : public ShapeFix_Root
51 //! Empty constructor;
52 Standard_EXPORT ShapeFix_Solid();
54 //! Initializes by solid.
55 Standard_EXPORT ShapeFix_Solid(const TopoDS_Solid& solid);
57 //! Initializes by solid .
58 Standard_EXPORT virtual void Init (const TopoDS_Solid& solid);
60 //! Iterates on shells and performs fixes
61 //! (calls ShapeFix_Shell for each subshell). The passed
62 //! progress indicator allows user to consult the current
63 //! progress stage and abort algorithm if needed.
64 Standard_EXPORT virtual Standard_Boolean Perform (const Message_ProgressRange& theProgress = Message_ProgressRange());
66 //! Calls MakeSolid and orients the solid to be "not infinite"
67 Standard_EXPORT TopoDS_Solid SolidFromShell (const TopoDS_Shell& shell);
69 //! Returns the status of the last Fix.
70 Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
72 //! Returns resulting solid.
73 Standard_EXPORT TopoDS_Shape Solid() const;
75 //! Returns tool for fixing shells.
76 Handle(ShapeFix_Shell) FixShellTool() const
81 //! Sets message registrator
82 Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE;
84 //! Sets basic precision value (also to FixShellTool)
85 Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE;
87 //! Sets minimal allowed tolerance (also to FixShellTool)
88 Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE;
90 //! Sets maximal allowed tolerance (also to FixShellTool)
91 Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE;
93 //! Returns (modifiable) the mode for applying fixes of
94 //! ShapeFix_Shell, by default True.
95 Standard_Integer& FixShellMode()
97 return myFixShellMode;
100 //! Returns (modifiable) the mode for applying analysis and fixes of
101 //! orientation of shells in the solid; by default True.
102 Standard_Integer& FixShellOrientationMode()
104 return myFixShellOrientationMode;
107 //! Returns (modifiable) the mode for creation of solids.
108 //! If mode myCreateOpenSolidMode is equal to true
109 //! solids are created from open shells
110 //! else solids are created from closed shells only.
111 //! ShapeFix_Shell, by default False.
112 Standard_Boolean& CreateOpenSolidMode()
114 return myCreateOpenSolidMode;
117 //! In case of multiconnexity returns compound of fixed solids
118 //! else returns one solid.
119 Standard_EXPORT TopoDS_Shape Shape();
121 DEFINE_STANDARD_RTTIEXT(ShapeFix_Solid,ShapeFix_Root)
124 TopoDS_Shape mySolid;
125 Handle(ShapeFix_Shell) myFixShell;
126 Standard_Integer myStatus;
127 Standard_Integer myFixShellMode;
128 Standard_Integer myFixShellOrientationMode;
129 Standard_Boolean myCreateOpenSolidMode;
132 #endif // _ShapeFix_Solid_HeaderFile