1 // Created on: 1996-02-13
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1996-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 _BRepOffsetAPI_MakeOffsetShape_HeaderFile
18 #define _BRepOffsetAPI_MakeOffsetShape_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <BRepOffset_MakeOffset.hxx>
25 #include <BRepOffset_MakeSimpleOffset.hxx>
26 #include <BRepBuilderAPI_MakeShape.hxx>
27 #include <Standard_Real.hxx>
28 #include <BRepOffset_Mode.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <GeomAbs_JoinType.hxx>
31 #include <TopTools_ListOfShape.hxx>
33 class BRepOffset_MakeOffset;
36 //! Describes functions to build a shell out of a shape. The
37 //! result is an unlooped shape parallel to the source shape.
38 //! A MakeOffsetShape object provides a framework for:
39 //! - defining the construction of a shell
40 //! - implementing the construction algorithm
41 //! - consulting the result.
42 class BRepOffsetAPI_MakeOffsetShape : public BRepBuilderAPI_MakeShape
48 //! Constructor does nothing.
49 Standard_EXPORT BRepOffsetAPI_MakeOffsetShape();
51 //! Deprecated constructor. Please avoid usage of this constructor.
52 Standard_DEPRECATED("Deprecated constructor. Please use constructor without parameters and one of perform methods.")
53 Standard_EXPORT BRepOffsetAPI_MakeOffsetShape(const TopoDS_Shape& S,
54 const Standard_Real Offset,
55 const Standard_Real Tol,
56 const BRepOffset_Mode Mode = BRepOffset_Skin,
57 const Standard_Boolean Intersection = Standard_False,
58 const Standard_Boolean SelfInter = Standard_False,
59 const GeomAbs_JoinType Join = GeomAbs_Arc,
60 const Standard_Boolean RemoveIntEdges = Standard_False);
62 //! Constructs offset shape for the given one using simple algorithm without intersections computation.
63 Standard_EXPORT void PerformBySimple(const TopoDS_Shape& theS,
64 const Standard_Real theOffsetValue);
66 //! Constructs a shape parallel to the shape S, where
67 //! - S may be a face, a shell, a solid or a compound of these shape kinds;
68 //! - Offset is the offset value. The offset shape is constructed:
69 //! - outside S, if Offset is positive,
70 //! - inside S, if Offset is negative;
71 //! - Tol defines the coincidence tolerance criterion for generated shapes;
72 //! - Mode defines the construction type of parallels
73 //! applied to the free edges of shape S; currently, only one
74 //! construction type is implemented, namely the one where the free
75 //! edges do not generate parallels; this corresponds to the default
76 //! value BRepOffset_Skin;
77 //! - Intersection specifies how the algorithm must work in
78 //! order to limit the parallels to two adjacent shapes:
79 //! - if Intersection is false (default value), the intersection
80 //! is calculated with the parallels to the two adjacent shapes,
81 //! - if Intersection is true, the intersection is calculated by
82 //! taking all generated parallels into account; this computation method is
83 //! more general as it avoids some self-intersections generated in the
84 //! offset shape from features of small dimensions on shape S, however this
85 //! method has not been completely implemented and therefore is not
86 //! recommended for use;
87 //! - SelfInter tells the algorithm whether a computation
88 //! to eliminate self-intersections must be applied to the resulting
89 //! shape; however, as this functionality is not yet
90 //! implemented, it is recommended to use the default value (false);
91 //! - Join defines how to fill the holes that may appear between
92 //! parallels to the two adjacent faces. It may take values
93 //! GeomAbs_Arc or GeomAbs_Intersection:
94 //! - if Join is equal to GeomAbs_Arc, then pipes are generated
95 //! between two free edges of two adjacent parallels,
96 //! and spheres are generated on "images" of vertices;
97 //! it is the default value,
98 //! - if Join is equal to GeomAbs_Intersection, then the parallels to the
99 //! two adjacent faces are enlarged and intersected,
100 //! so that there are no free edges on parallels to faces.
101 //! RemoveIntEdges flag defines whether to remove the INTERNAL edges
102 //! from the result or not.
104 //! 1. All the faces of the shape S should be based on the surfaces
105 //! with continuity at least C1.
106 //! 2. The offset value should be sufficiently small to avoid
107 //! self-intersections in resulting shape. Otherwise these
108 //! self-intersections may appear inside an offset face if its
109 //! initial surface is not plane or sphere or cylinder, also some
110 //! non-adjacent offset faces may intersect each other. Also, some
111 //! offset surfaces may "turn inside out".
112 //! 3. The algorithm may fail if the shape S contains vertices where
113 //! more than 3 edges converge.
114 //! 4. Since 3d-offset algorithm involves intersection of surfaces,
115 //! it is under limitations of surface intersection algorithm.
116 //! 5. A result cannot be generated if the underlying geometry of S is
117 //! BSpline with continuity C0.
119 //! Geom_UndefinedDerivative if the underlying
120 //! geometry of S is BSpline with continuity C0.
121 Standard_EXPORT void PerformByJoin(const TopoDS_Shape& S,
122 const Standard_Real Offset,
123 const Standard_Real Tol,
124 const BRepOffset_Mode Mode = BRepOffset_Skin,
125 const Standard_Boolean Intersection = Standard_False,
126 const Standard_Boolean SelfInter = Standard_False,
127 const GeomAbs_JoinType Join = GeomAbs_Arc,
128 const Standard_Boolean RemoveIntEdges = Standard_False);
130 //! Returns instance of the unrelying intersection / arc algorithm.
131 Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const;
134 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
136 //! Returns the list of shapes generated from the shape <S>.
137 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
139 //! Returns the list of shapes Modified from the shape <S>.
140 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE;
142 //! Returns true if the shape has been removed from the result.
143 Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& S) Standard_OVERRIDE;
145 //! Returns offset join type.
146 Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
157 OffsetAlgo_Type myLastUsedAlgo;
159 BRepOffset_MakeOffset myOffsetShape;
160 BRepOffset_MakeSimpleOffset mySimpleOffsetShape;
163 #endif // _BRepOffsetAPI_MakeOffsetShape_HeaderFile