1 // Created on: 1995-10-26
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1995-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 _BRepOffset_MakeOffset_HeaderFile
18 #define _BRepOffset_MakeOffset_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Real.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <BRepOffset_Mode.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <GeomAbs_JoinType.hxx>
29 #include <TopTools_DataMapOfShapeReal.hxx>
30 #include <TopTools_IndexedMapOfShape.hxx>
31 #include <BRepOffset_Analyse.hxx>
32 #include <BRepAlgo_Image.hxx>
33 #include <TopTools_ListOfShape.hxx>
34 #include <BRepOffset_Error.hxx>
35 #include <BRepOffset_MakeLoops.hxx>
36 #include <TopTools_MapOfShape.hxx>
37 #include <BRepOffset_DataMapOfShapeOffset.hxx>
41 class BRepOffset_Analyse;
43 class BRepOffset_Inter3d;
47 class BRepOffset_MakeOffset
54 Standard_EXPORT BRepOffset_MakeOffset();
56 Standard_EXPORT BRepOffset_MakeOffset(const TopoDS_Shape& S, const Standard_Real Offset, const Standard_Real Tol, const BRepOffset_Mode Mode = BRepOffset_Skin, const Standard_Boolean Intersection = Standard_False, const Standard_Boolean SelfInter = Standard_False, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean Thickening = Standard_False);
58 Standard_EXPORT void Initialize (const TopoDS_Shape& S, const Standard_Real Offset, const Standard_Real Tol, const BRepOffset_Mode Mode = BRepOffset_Skin, const Standard_Boolean Intersection = Standard_False, const Standard_Boolean SelfInter = Standard_False, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean Thickening = Standard_False);
60 Standard_EXPORT void Clear();
62 //! Add Closing Faces, <F> has to be in the initial
64 Standard_EXPORT void AddFace (const TopoDS_Face& F);
66 //! set the offset <Off> on the Face <F>
67 Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off);
69 Standard_EXPORT void MakeOffsetShape();
71 Standard_EXPORT void MakeThickSolid();
73 Standard_EXPORT const BRepOffset_Analyse& GetAnalyse() const;
75 Standard_EXPORT Standard_Boolean IsDone() const;
77 Standard_EXPORT const TopoDS_Shape& Shape() const;
79 //! returns information about offset state.
80 Standard_EXPORT BRepOffset_Error Error() const;
82 //! Returns <Image> containing links between initials
83 //! shapes and offset faces.
84 Standard_EXPORT const BRepAlgo_Image& OffsetFacesFromShapes() const;
87 Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
89 //! Returns <Image> containing links between initials
90 //! shapes and offset edges.
91 Standard_EXPORT const BRepAlgo_Image& OffsetEdgesFromShapes() const;
93 //! Returns the list of closing faces stores by AddFace
94 Standard_EXPORT const TopTools_IndexedMapOfShape& ClosingFaces() const;
96 //! Makes pre analysis of possibility offset perform. Use method Error() to get more information.
97 //! Finds first error. List of checks:
98 //! 1) Check for existence object with non-null offset.
99 //! 2) Check for connectivity in offset shell.
100 //! 3) Check continuity of input surfaces.
101 //! 4) Check for normals existence on grid.
102 //! @return True if possible make computations and false otherwise.
103 Standard_EXPORT Standard_Boolean CheckInputData();
105 //! Return bad shape, which obtained in CheckInputData.
106 Standard_EXPORT const TopoDS_Shape& GetBadShape() const;
120 Standard_EXPORT void BuildOffsetByArc();
122 Standard_EXPORT void BuildOffsetByInter();
124 Standard_EXPORT void SelfInter (TopTools_MapOfShape& Modif);
126 Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter);
128 Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif, const TopTools_IndexedMapOfShape& NewEdges);
130 Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif);
132 Standard_EXPORT void MakeLoopsOnContext (TopTools_MapOfShape& Modif);
134 Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif);
136 Standard_EXPORT void MakeShells();
138 Standard_EXPORT void SelectShells();
140 Standard_EXPORT void EncodeRegularity();
142 Standard_EXPORT void MakeSolid();
144 Standard_EXPORT void ToContext (BRepOffset_DataMapOfShapeOffset& MapSF);
146 //! Private method use to update the map face<->offset
147 Standard_EXPORT void UpdateFaceOffset();
149 //! Private method used to correct degenerated edges on conical faces
150 Standard_EXPORT void CorrectConicalFaces();
152 //! Private method used to build walls for thickening the shell
153 Standard_EXPORT void MakeMissingWalls();
156 Standard_Real myOffset;
158 TopoDS_Shape myShape;
159 BRepOffset_Mode myMode;
160 Standard_Boolean myInter;
161 Standard_Boolean mySelfInter;
162 GeomAbs_JoinType myJoin;
163 Standard_Boolean myThickening;
164 TopTools_DataMapOfShapeReal myFaceOffset;
165 TopTools_IndexedMapOfShape myFaces;
166 BRepOffset_Analyse myAnalyse;
167 TopoDS_Shape myOffsetShape;
168 BRepAlgo_Image myInitOffsetFace;
169 BRepAlgo_Image myInitOffsetEdge;
170 BRepAlgo_Image myImageOffset;
171 TopTools_ListOfShape myWalls;
172 Handle(BRepAlgo_AsDes) myAsDes;
173 Standard_Boolean myDone;
174 BRepOffset_Error myError;
175 BRepOffset_MakeLoops myMakeLoops;
176 Standard_Boolean myIsPerformSewing; // Handle bad walls in thicksolid mode.
177 TopoDS_Shape myBadShape;
188 #endif // _BRepOffset_MakeOffset_HeaderFile