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 const TopoDS_Shape& InitShape() const
100 //! returns information about offset state.
101 Standard_EXPORT BRepOffset_Error Error() const;
103 //! Returns <Image> containing links between initials
104 //! shapes and offset faces.
105 Standard_EXPORT const BRepAlgo_Image& OffsetFacesFromShapes() const;
108 Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
110 //! Returns <Image> containing links between initials
111 //! shapes and offset edges.
112 Standard_EXPORT const BRepAlgo_Image& OffsetEdgesFromShapes() const;
114 //! Returns the list of closing faces stores by AddFace
115 Standard_EXPORT const TopTools_IndexedMapOfShape& ClosingFaces() const;
117 //! Makes pre analysis of possibility offset perform. Use method Error() to get more information.
118 //! Finds first error. List of checks:
119 //! 1) Check for existence object with non-null offset.
120 //! 2) Check for connectivity in offset shell.
121 //! 3) Check continuity of input surfaces.
122 //! 4) Check for normals existence on grid.
123 //! @return True if possible make computations and false otherwise.
124 Standard_EXPORT Standard_Boolean CheckInputData();
126 //! Return bad shape, which obtained in CheckInputData.
127 Standard_EXPORT const TopoDS_Shape& GetBadShape() const;
129 public: //! @name History methods
131 //! Returns the list of shapes generated from the shape <S>.
132 Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS);
134 //! Returns the list of shapes modified from the shape <S>.
135 Standard_EXPORT const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS);
137 //! Returns true if the shape S has been deleted.
138 Standard_EXPORT Standard_Boolean IsDeleted (const TopoDS_Shape& S);
146 Standard_EXPORT void BuildOffsetByArc();
148 Standard_EXPORT void BuildOffsetByInter();
150 //! Make Offset faces
151 Standard_EXPORT void MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF);
153 Standard_EXPORT void SelfInter (TopTools_MapOfShape& Modif);
155 Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter);
157 Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif, const TopTools_IndexedMapOfShape& NewEdges);
159 Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif);
161 Standard_EXPORT void MakeLoopsOnContext (TopTools_MapOfShape& Modif);
163 Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif);
165 Standard_EXPORT void MakeShells();
167 Standard_EXPORT void SelectShells();
169 Standard_EXPORT void EncodeRegularity();
171 //! Replace roots in history maps
172 Standard_EXPORT void ReplaceRoots();
174 Standard_EXPORT void MakeSolid();
176 Standard_EXPORT void ToContext (BRepOffset_DataMapOfShapeOffset& MapSF);
178 //! Private method use to update the map face<->offset
179 Standard_EXPORT void UpdateFaceOffset();
181 //! Private method used to correct degenerated edges on conical faces
182 Standard_EXPORT void CorrectConicalFaces();
184 //! Private method used to build walls for thickening the shell
185 Standard_EXPORT void MakeMissingWalls();
187 //! Removes INTERNAL edges from the result
188 Standard_EXPORT void RemoveInternalEdges();
191 Standard_EXPORT void IntersectEdges (const TopTools_ListOfShape& theFaces,
192 BRepOffset_DataMapOfShapeOffset& theMapSF,
193 TopTools_DataMapOfShapeShape& theMES,
194 TopTools_DataMapOfShapeShape& theBuild,
195 Handle(BRepAlgo_AsDes)& theAsDes,
196 Handle(BRepAlgo_AsDes)& theAsDes2d);
198 //! Building of the splits of the offset faces for mode Complete
199 //! and joint type Intersection. This method is an advanced alternative
200 //! for BRepOffset_MakeLoops::Build method.
201 //! Currently the Complete intersection mode is limited to work only on planar cases.
202 Standard_EXPORT void BuildSplitsOfExtendedFaces(const TopTools_ListOfShape& theLF,
203 const BRepOffset_Analyse& theAnalyse,
204 Handle(BRepAlgo_AsDes)& theAsDes,
205 TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
206 TopTools_DataMapOfShapeShape& theFacesOrigins,
207 TopTools_DataMapOfShapeShape& theETrimEInf,
208 BRepAlgo_Image& theImage);
210 //! Building of the splits of the already trimmed offset faces for mode Complete
211 //! and joint type Intersection.
212 Standard_EXPORT void BuildSplitsOfTrimmedFaces(const TopTools_ListOfShape& theLF,
213 Handle(BRepAlgo_AsDes)& theAsDes,
214 BRepAlgo_Image& theImage);
216 Standard_Real myOffset;
218 TopoDS_Shape myShape;
219 BRepOffset_Mode myMode;
220 Standard_Boolean myInter;
221 Standard_Boolean mySelfInter;
222 GeomAbs_JoinType myJoin;
223 Standard_Boolean myThickening;
224 Standard_Boolean myRemoveIntEdges;
225 TopTools_DataMapOfShapeReal myFaceOffset;
226 TopTools_IndexedMapOfShape myFaces;
227 BRepOffset_Analyse myAnalyse;
228 TopoDS_Shape myOffsetShape;
229 BRepAlgo_Image myInitOffsetFace;
230 BRepAlgo_Image myInitOffsetEdge;
231 BRepAlgo_Image myImageOffset;
232 TopTools_ListOfShape myWalls;
233 Handle(BRepAlgo_AsDes) myAsDes;
234 Standard_Boolean myDone;
235 BRepOffset_Error myError;
236 BRepOffset_MakeLoops myMakeLoops;
237 Standard_Boolean myIsPerformSewing; // Handle bad walls in thicksolid mode.
238 Standard_Boolean myIsPlanar;
239 TopoDS_Shape myBadShape;
240 TopTools_ListOfShape myGenerated;
241 TopTools_MapOfShape myResMap;
244 #endif // _BRepOffset_MakeOffset_HeaderFile