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 <BRepBuilderAPI_MakeShape.hxx>
26 #include <Standard_Real.hxx>
27 #include <BRepOffset_Mode.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <GeomAbs_JoinType.hxx>
30 #include <TopTools_ListOfShape.hxx>
32 class BRepOffset_MakeOffset;
35 //! Describes functions to build a shell out of a shape. The
36 //! result is an unlooped shape parallel to the source shape.
37 //! A MakeOffsetShape object provides a framework for:
38 //! - defining the construction of a shell
39 //! - implementing the construction algorithm
40 //! - consulting the result.
41 class BRepOffsetAPI_MakeOffsetShape : public BRepBuilderAPI_MakeShape
48 Standard_EXPORT BRepOffsetAPI_MakeOffsetShape();
50 //! Constructs a shape parallel to the shape S, where
51 //! - S may be a face, a shell, a solid or a compound of these shape kinds;
52 //! - Offset is the offset value. The offset shape is constructed:
53 //! - outside S, if Offset is positive,
54 //! - inside S, if Offset is negative;
55 //! - Tol defines the coincidence tolerance criterion for generated shapes;
56 //! - Mode defines the construction type of parallels
57 //! applied to the free edges of shape S; currently, only one
58 //! construction type is implemented, namely the one where the free
59 //! edges do not generate parallels; this corresponds to the default
60 //! value BRepOffset_Skin;
61 //! - Intersection specifies how the algorithm must work in
62 //! order to limit the parallels to two adjacent shapes:
63 //! - if Intersection is false (default value), the intersection
64 //! is calculated with the parallels to the two adjacent shapes,
65 //! - if Intersection is true, the intersection is calculated by
66 //! taking all generated parallels into account; this computation method is
67 //! more general as it avoids some self-intersections generated in the
68 //! offset shape from features of small dimensions on shape S, however this
69 //! method has not been completely implemented and therefore is not
70 //! recommended for use;
71 //! - SelfInter tells the algorithm whether a computation
72 //! to eliminate self-intersections must be applied to the resulting
73 //! shape; however, as this functionality is not yet
74 //! implemented, it is recommended to use the default value (false);
75 //! - Join defines how to fill the holes that may appear between
76 //! parallels to the two adjacent faces. It may take values
77 //! GeomAbs_Arc or GeomAbs_Intersection:
78 //! - if Join is equal to GeomAbs_Arc, then pipes are generated
79 //! between two free edges of two adjacent parallels,
80 //! and spheres are generated on "images" of vertices;
81 //! it is the default value,
82 //! - if Join is equal to GeomAbs_Intersection, then the parallels to the
83 //! two adjacent faces are enlarged and intersected,
84 //! so that there are no free edges on parallels to faces.
85 //! RemoveIntEdges flag defines whether to remove the INTERNAL edges
86 //! from the result or not.
88 //! 1. All the faces of the shape S should be based on the surfaces
89 //! with continuity at least C1.
90 //! 2. The offset value should be sufficiently small to avoid
91 //! self-intersections in resulting shape. Otherwise these
92 //! self-intersections may appear inside an offset face if its
93 //! initial surface is not plane or sphere or cylinder, also some
94 //! non-adjacent offset faces may intersect each other. Also, some
95 //! offset surfaces may "turn inside out".
96 //! 3. The algorithm may fail if the shape S contains vertices where
97 //! more than 3 edges converge.
98 //! 4. Since 3d-offset algorithm involves intersection of surfaces,
99 //! it is under limitations of surface intersection algorithm.
100 //! 5. A result cannot be generated if the underlying geometry of S is
101 //! BSpline with continuity C0.
103 //! Geom_UndefinedDerivative if the underlying
104 //! geometry of S is BSpline with continuity C0.
105 Standard_EXPORT BRepOffsetAPI_MakeOffsetShape(const TopoDS_Shape& S,
106 const Standard_Real Offset,
107 const Standard_Real Tol,
108 const BRepOffset_Mode Mode = BRepOffset_Skin,
109 const Standard_Boolean Intersection = Standard_False,
110 const Standard_Boolean SelfInter = Standard_False,
111 const GeomAbs_JoinType Join = GeomAbs_Arc,
112 const Standard_Boolean RemoveIntEdges = Standard_False);
114 Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const;
116 //! Builds the resulting shape (redefined from MakeShape).
117 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
119 //! Returns the list of shapes generated from the
121 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
123 //! Returns the list of edges generated from the shape <S>.
124 Standard_EXPORT const TopTools_ListOfShape& GeneratedEdge (const TopoDS_Shape& S);
126 //! Returns offset join type.
127 Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
136 BRepOffset_MakeOffset myOffsetShape;
153 #endif // _BRepOffsetAPI_MakeOffsetShape_HeaderFile