Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:15

0001 // Created on: 1996-02-13
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepOffsetAPI_MakeOffsetShape_HeaderFile
0018 #define _BRepOffsetAPI_MakeOffsetShape_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepOffset_MakeOffset.hxx>
0025 #include <BRepOffset_MakeSimpleOffset.hxx>
0026 #include <BRepBuilderAPI_MakeShape.hxx>
0027 #include <BRepOffset_Mode.hxx>
0028 #include <GeomAbs_JoinType.hxx>
0029 #include <TopTools_ListOfShape.hxx>
0030 class TopoDS_Shape;
0031 
0032 
0033 //! Describes functions to build a shell out of a shape. The
0034 //! result is an unlooped shape parallel to the source shape.
0035 //! A MakeOffsetShape object provides a framework for:
0036 //! - defining the construction of a shell
0037 //! - implementing the construction algorithm
0038 //! - consulting the result.
0039 class BRepOffsetAPI_MakeOffsetShape  : public BRepBuilderAPI_MakeShape
0040 {
0041 public:
0042 
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Constructor does nothing.
0046   Standard_EXPORT BRepOffsetAPI_MakeOffsetShape();
0047 
0048   //! Constructs offset shape for the given one using simple algorithm without intersections computation.
0049   Standard_EXPORT void PerformBySimple(const TopoDS_Shape& theS,
0050                                        const Standard_Real theOffsetValue);
0051 
0052   //! Constructs a shape parallel to the shape S, where
0053   //! - S may be a face, a shell, a solid or a compound of these shape kinds;
0054   //! - Offset is the offset value. The offset shape is constructed:
0055   //! - outside S, if Offset is positive,
0056   //! - inside S, if Offset is negative;
0057   //! - Tol defines the coincidence tolerance criterion for generated shapes;
0058   //! - Mode defines the construction type of parallels
0059   //! applied to the free edges of shape S; currently, only one
0060   //! construction type is implemented, namely the one where the free
0061   //! edges do not generate parallels; this corresponds to the default
0062   //! value BRepOffset_Skin;
0063   //! - Intersection specifies how the algorithm must work in
0064   //! order to limit the parallels to two adjacent shapes:
0065   //! - if Intersection is false (default value), the intersection
0066   //! is calculated with the parallels to the two adjacent shapes,
0067   //! - if Intersection is true, the intersection is calculated by
0068   //! taking all generated parallels into account; this computation method is
0069   //! more general as it avoids some self-intersections generated in the
0070   //! offset shape from features of small dimensions on shape S, however this
0071   //! method has not been completely implemented and therefore is not
0072   //! recommended for use;
0073   //! - SelfInter tells the algorithm whether a computation
0074   //! to eliminate self-intersections must be applied to the resulting
0075   //! shape; however, as this functionality is not yet
0076   //! implemented, it is recommended to use the default value (false);
0077   //! - Join defines how to fill the holes that may appear between
0078   //! parallels to the two adjacent faces. It may take values
0079   //! GeomAbs_Arc or GeomAbs_Intersection:
0080   //! - if Join is equal to GeomAbs_Arc, then pipes are generated
0081   //! between two free edges of two adjacent parallels,
0082   //! and spheres are generated on "images" of vertices;
0083   //! it is the default value,
0084   //! - if Join is equal to GeomAbs_Intersection, then the parallels to the
0085   //! two adjacent faces are enlarged and intersected,
0086   //! so that there are no free edges on parallels to faces.
0087   //! RemoveIntEdges flag defines whether to remove the INTERNAL edges 
0088   //! from the result or not.
0089   //! Warnings
0090   //! 1. All the faces of the shape S should be based on the surfaces
0091   //! with continuity at least C1.
0092   //! 2. The offset value should be sufficiently small to avoid
0093   //! self-intersections in resulting shape. Otherwise these
0094   //! self-intersections may appear inside an offset face if its
0095   //! initial surface is not plane or sphere or cylinder, also some
0096   //! non-adjacent offset faces may intersect each other. Also, some
0097   //! offset surfaces may "turn inside out".
0098   //! 3. The algorithm may fail if the shape S contains vertices where
0099   //! more than 3 edges converge.
0100   //! 4. Since 3d-offset algorithm involves intersection of surfaces,
0101   //! it is under limitations of surface intersection algorithm.
0102   //! 5. A result cannot be generated if the underlying geometry of S is
0103   //! BSpline with continuity C0.
0104   //! Exceptions
0105   //! Geom_UndefinedDerivative if the underlying
0106   //! geometry of S is BSpline with continuity C0.
0107   Standard_EXPORT void PerformByJoin(const TopoDS_Shape& S,
0108                                      const Standard_Real Offset,
0109                                      const Standard_Real Tol,
0110                                      const BRepOffset_Mode Mode = BRepOffset_Skin,
0111                                      const Standard_Boolean Intersection = Standard_False,
0112                                      const Standard_Boolean SelfInter = Standard_False,
0113                                      const GeomAbs_JoinType Join = GeomAbs_Arc,
0114                                      const Standard_Boolean RemoveIntEdges = Standard_False,
0115                                      const Message_ProgressRange& theRange = Message_ProgressRange());
0116 
0117   //! Returns instance of the unrelying intersection / arc algorithm.
0118   Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const;
0119 
0120   //! Does nothing.
0121   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0122   
0123   //! Returns the list of shapes generated from the shape <S>.
0124   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
0125 
0126   //! Returns the list of shapes Modified from the shape <S>.
0127   Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE;
0128 
0129   //! Returns true if the shape has been removed from the result.
0130   Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& S) Standard_OVERRIDE;
0131 
0132   //! Returns offset join type.
0133   Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
0134 
0135 protected:
0136 
0137   enum OffsetAlgo_Type
0138   {
0139     OffsetAlgo_NONE,
0140     OffsetAlgo_JOIN,
0141     OffsetAlgo_SIMPLE
0142   };
0143 
0144   OffsetAlgo_Type myLastUsedAlgo;
0145 
0146   BRepOffset_MakeOffset myOffsetShape;
0147   BRepOffset_MakeSimpleOffset mySimpleOffsetShape;
0148 };
0149 
0150 #endif // _BRepOffsetAPI_MakeOffsetShape_HeaderFile