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,
57 const Standard_Real Offset,
58 const Standard_Real Tol,
59 const BRepOffset_Mode Mode = BRepOffset_Skin,
60 const Standard_Boolean Intersection = Standard_False,
61 const Standard_Boolean SelfInter = Standard_False,
62 const GeomAbs_JoinType Join = GeomAbs_Arc,
63 const Standard_Boolean Thickening = Standard_False,
64 const Standard_Boolean RemoveIntEdges = Standard_False);
66 Standard_EXPORT void Initialize (const TopoDS_Shape& S,
67 const Standard_Real Offset,
68 const Standard_Real Tol,
69 const BRepOffset_Mode Mode = BRepOffset_Skin,
70 const Standard_Boolean Intersection = Standard_False,
71 const Standard_Boolean SelfInter = Standard_False,
72 const GeomAbs_JoinType Join = GeomAbs_Arc,
73 const Standard_Boolean Thickening = Standard_False,
74 const Standard_Boolean RemoveIntEdges = Standard_False);
76 Standard_EXPORT void Clear();
78 //! Add Closing Faces, <F> has to be in the initial
80 Standard_EXPORT void AddFace (const TopoDS_Face& F);
82 //! set the offset <Off> on the Face <F>
83 Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off);
85 Standard_EXPORT void MakeOffsetShape();
87 Standard_EXPORT void MakeThickSolid();
89 Standard_EXPORT const BRepOffset_Analyse& GetAnalyse() const;
91 Standard_EXPORT Standard_Boolean IsDone() const;
93 Standard_EXPORT const TopoDS_Shape& Shape() const;
95 //! returns information about offset state.
96 Standard_EXPORT BRepOffset_Error Error() const;
98 //! Returns <Image> containing links between initials
99 //! shapes and offset faces.
100 Standard_EXPORT const BRepAlgo_Image& OffsetFacesFromShapes() const;
103 Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
105 //! Returns <Image> containing links between initials
106 //! shapes and offset edges.
107 Standard_EXPORT const BRepAlgo_Image& OffsetEdgesFromShapes() const;
109 //! Returns the list of closing faces stores by AddFace
110 Standard_EXPORT const TopTools_IndexedMapOfShape& ClosingFaces() const;
112 //! Makes pre analysis of possibility offset perform. Use method Error() to get more information.
113 //! Finds first error. List of checks:
114 //! 1) Check for existence object with non-null offset.
115 //! 2) Check for connectivity in offset shell.
116 //! 3) Check continuity of input surfaces.
117 //! 4) Check for normals existence on grid.
118 //! @return True if possible make computations and false otherwise.
119 Standard_EXPORT Standard_Boolean CheckInputData();
121 //! Return bad shape, which obtained in CheckInputData.
122 Standard_EXPORT const TopoDS_Shape& GetBadShape() const;
130 Standard_EXPORT void BuildOffsetByArc();
132 Standard_EXPORT void BuildOffsetByInter();
134 //! Make Offset faces
135 Standard_EXPORT void MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF);
137 Standard_EXPORT void SelfInter (TopTools_MapOfShape& Modif);
139 Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter);
141 Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif, const TopTools_IndexedMapOfShape& NewEdges);
143 Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif);
145 Standard_EXPORT void MakeLoopsOnContext (TopTools_MapOfShape& Modif);
147 Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif);
149 Standard_EXPORT void MakeShells();
151 Standard_EXPORT void SelectShells();
153 Standard_EXPORT void EncodeRegularity();
155 Standard_EXPORT void MakeSolid();
157 Standard_EXPORT void ToContext (BRepOffset_DataMapOfShapeOffset& MapSF);
159 //! Private method use to update the map face<->offset
160 Standard_EXPORT void UpdateFaceOffset();
162 //! Private method used to correct degenerated edges on conical faces
163 Standard_EXPORT void CorrectConicalFaces();
165 //! Private method used to build walls for thickening the shell
166 Standard_EXPORT void MakeMissingWalls();
168 //! Removes INTERNAL edges from the result
169 Standard_EXPORT void RemoveInternalEdges();
172 Standard_EXPORT void IntersectEdges (const TopoDS_Shape& theShape,
173 BRepOffset_DataMapOfShapeOffset& theMapSF,
174 TopTools_DataMapOfShapeShape& theMES,
175 TopTools_DataMapOfShapeShape& theBuild,
176 Handle(BRepAlgo_AsDes)& theAsDes,
177 Handle(BRepAlgo_AsDes)& theAsDes2d);
179 //! Building of the splits of the offset faces for mode Complete
180 //! and joint type Intersection. This method is an advanced alternative
181 //! for BRepOffset_MakeLoops::Build method.
182 //! Currently the Complete intersection mode is limited to work only on planar cases.
183 Standard_EXPORT void BuildSplitsOfExtendedFaces(const TopTools_ListOfShape& theLF,
184 Handle(BRepAlgo_AsDes)& theAsDes,
185 TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
186 TopTools_DataMapOfShapeShape& theFacesOrigins,
187 TopTools_DataMapOfShapeShape& theETrimEInf,
188 BRepAlgo_Image& theImage);
190 //! Building of the splits of the already trimmed offset faces for mode Complete
191 //! and joint type Intersection.
192 Standard_EXPORT void BuildSplitsOfTrimmedFaces(const TopTools_ListOfShape& theLF,
193 Handle(BRepAlgo_AsDes)& theAsDes,
194 BRepAlgo_Image& theImage);
196 Standard_Real myOffset;
198 TopoDS_Shape myShape;
199 BRepOffset_Mode myMode;
200 Standard_Boolean myInter;
201 Standard_Boolean mySelfInter;
202 GeomAbs_JoinType myJoin;
203 Standard_Boolean myThickening;
204 Standard_Boolean myRemoveIntEdges;
205 TopTools_DataMapOfShapeReal myFaceOffset;
206 TopTools_IndexedMapOfShape myFaces;
207 BRepOffset_Analyse myAnalyse;
208 TopoDS_Shape myOffsetShape;
209 BRepAlgo_Image myInitOffsetFace;
210 BRepAlgo_Image myInitOffsetEdge;
211 BRepAlgo_Image myImageOffset;
212 TopTools_ListOfShape myWalls;
213 Handle(BRepAlgo_AsDes) myAsDes;
214 Standard_Boolean myDone;
215 BRepOffset_Error myError;
216 BRepOffset_MakeLoops myMakeLoops;
217 Standard_Boolean myIsPerformSewing; // Handle bad walls in thicksolid mode.
218 Standard_Boolean myIsPlanar;
219 TopoDS_Shape myBadShape;
223 #endif // _BRepOffset_MakeOffset_HeaderFile