Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-09-18
0002 // Created by: Bruno DUMORTIER
0003 // Copyright (c) 1995-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_MakeOffset_HeaderFile
0018 #define _BRepOffsetAPI_MakeOffset_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Face.hxx>
0024 #include <TopTools_ListOfShape.hxx>
0025 #include <BRepFill_ListOfOffsetWire.hxx>
0026 #include <BRepBuilderAPI_MakeShape.hxx>
0027 class TopoDS_Wire;
0028 class TopoDS_Shape;
0029 
0030 
0031 //! Describes algorithms for offsetting wires from a set of
0032 //! wires contained in a planar face.
0033 //! A MakeOffset object provides a framework for:
0034 //! - defining the construction of an offset,
0035 //! - implementing the construction algorithm, and
0036 //! - consulting the result.
0037 class BRepOffsetAPI_MakeOffset  : public BRepBuilderAPI_MakeShape
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044   //! Constructs an algorithm for creating an empty offset
0045   Standard_EXPORT BRepOffsetAPI_MakeOffset();
0046   
0047   //! Constructs an algorithm for creating an algorithm
0048   //! to build parallels to the spine Spine
0049   Standard_EXPORT BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
0050   
0051   //! Initializes the algorithm to construct parallels to the spine Spine.
0052   //! Join defines the type of parallel generated by the
0053   //! salient vertices of the spine.
0054   //! The default type is GeomAbs_Arc where the vertices generate
0055   //! sections of a circle.
0056   //! If join type is GeomAbs_Intersection, the edges that
0057   //! intersect in a salient vertex generate the edges
0058   //! prolonged until intersection.
0059   Standard_EXPORT void Init (const TopoDS_Face& Spine, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
0060   
0061   Standard_EXPORT BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
0062   
0063   //! Initialize the evaluation of Offsetting.
0064   Standard_EXPORT void Init (const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
0065   
0066   //! Set approximation flag
0067   //! for convertion input contours into ones consisting of
0068   //! 2D circular arcs and 2D linear segments only.
0069   Standard_EXPORT void SetApprox (const Standard_Boolean ToApprox);
0070   
0071   //! Initializes the algorithm to construct parallels to the wire Spine.
0072   Standard_EXPORT void AddWire (const TopoDS_Wire& Spine);
0073   
0074   //! Computes a parallel to the spine at distance Offset and
0075   //! at an altitude Alt from the plane of the spine in relation
0076   //! to the normal to the spine.
0077   //! Exceptions: StdFail_NotDone if the offset is not built.
0078   Standard_EXPORT void Perform (const Standard_Real Offset, const Standard_Real Alt = 0.0);
0079   
0080   //! Builds the resulting shape (redefined from MakeShape).
0081   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0082   
0083   //! returns a list of the created shapes
0084   //! from the shape <S>.
0085   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
0086 
0087   //! Converts each wire of the face into contour consisting only of
0088   //! arcs and segments. New 3D curves are built too.
0089   Standard_EXPORT static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
0090                                                   const Standard_Real theAngleTolerance);
0091 
0092 
0093 protected:
0094 
0095 
0096 
0097 
0098 
0099 private:
0100 
0101 
0102 
0103   Standard_Boolean myIsInitialized;
0104   Standard_Boolean myLastIsLeft;
0105   GeomAbs_JoinType myJoin;
0106   Standard_Boolean myIsOpenResult;
0107   Standard_Boolean myIsToApprox;
0108   TopoDS_Face myFace;
0109   TopTools_ListOfShape myWires;
0110   BRepFill_ListOfOffsetWire myLeft;
0111   BRepFill_ListOfOffsetWire myRight;
0112 
0113 
0114 };
0115 
0116 
0117 
0118 
0119 
0120 
0121 
0122 #endif // _BRepOffsetAPI_MakeOffset_HeaderFile