Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-02-22
0002 // Created by: Jacques GOUSSARD
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_DraftAngle_HeaderFile
0018 #define _BRepOffsetAPI_DraftAngle_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopTools_ListOfShape.hxx>
0024 #include <BRepBuilderAPI_ModifyShape.hxx>
0025 #include <Draft_ErrorStatus.hxx>
0026 #include <BRepTools_ReShape.hxx>
0027 
0028 class TopoDS_Shape;
0029 class TopoDS_Face;
0030 class gp_Dir;
0031 class gp_Pln;
0032 
0033 // resolve name collisions with X11 headers
0034 #ifdef Status
0035   #undef Status
0036 #endif
0037 
0038 //! Taper-adding transformations on a shape.
0039 //! The resulting shape is constructed by defining one face
0040 //! to be tapered after another one, as well as the
0041 //! geometric properties of their tapered transformation.
0042 //! Each tapered transformation is propagated along the
0043 //! series of faces which are tangential to one another and
0044 //! which contains the face to be tapered.
0045 //! This algorithm is useful in the construction of molds or
0046 //! dies. It facilitates the removal of the article being produced.
0047 //! A DraftAngle object provides a framework for:
0048 //! - initializing the construction algorithm with a given shape,
0049 //! - acquiring the data characterizing the faces to be tapered,
0050 //! - implementing the construction algorithm, and
0051 //! - consulting the results.
0052 //! Warning
0053 //! - This algorithm treats planar, cylindrical and conical faces.
0054 //! - Do not use shapes, which with a draft angle added to
0055 //! a face would modify the topology. This would, for
0056 //! example, involve creation of new vertices, edges or
0057 //! faces, or suppression of existing vertices, edges or faces.
0058 //! - Any face, which is continuous in tangency with the
0059 //! face to be tapered, will also be tapered. These
0060 //! connected faces must also respect the above criteria.
0061 class BRepOffsetAPI_DraftAngle  : public BRepBuilderAPI_ModifyShape
0062 {
0063 public:
0064 
0065   DEFINE_STANDARD_ALLOC
0066 
0067   
0068   //! Constructs an empty algorithm to perform
0069   //! taper-adding transformations on faces of a shape.
0070   //! Use the Init function to define the shape to be tapered.
0071   Standard_EXPORT BRepOffsetAPI_DraftAngle();
0072   
0073   //! Initializes an algorithm to perform taper-adding
0074   //! transformations on faces of the shape S.
0075   //! S will be referred to as the initial shape of the algorithm.
0076   Standard_EXPORT BRepOffsetAPI_DraftAngle(const TopoDS_Shape& S);
0077   
0078   //! Cancels the results of all taper-adding transformations
0079   //! performed by this algorithm on the initial shape. These
0080   //! results will have been defined by successive calls to the function Add.
0081   Standard_EXPORT void Clear();
0082   
0083   //! Initializes, or reinitializes this taper-adding algorithm with the shape S.
0084   //! S will be referred to as the initial shape of this algorithm.
0085   Standard_EXPORT void Init (const TopoDS_Shape& S);
0086   
0087   //! Adds the face F, the direction
0088   //! Direction, the angle Angle, the plane NeutralPlane, and the flag
0089   //! Flag to the framework created at construction time, and with this
0090   //! data, defines the taper-adding transformation.
0091   //! F is a face, which belongs to the initial shape of this algorithm or
0092   //! to the shape loaded by the function Init.
0093   //! Only planar, cylindrical or conical faces can be tapered:
0094   //! - If the face F is planar, it is tapered by inclining it
0095   //! through the angle Angle about the line of intersection between the
0096   //! plane NeutralPlane and F.
0097   //! Direction indicates the side of NeutralPlane from which matter is
0098   //! removed if Angle is positive or added if Angle is negative.
0099   //! - If F is cylindrical or conical, it is transformed in the
0100   //! same way on a single face, resulting in a conical face if F
0101   //! is cylindrical, and a conical or cylindrical face if it is already conical.
0102   //! The taper-adding transformation is propagated from the face F along
0103   //! the series of planar, cylindrical or conical faces containing F,
0104   //! which are tangential to one another.
0105   //! Use the function AddDone to check if this taper-adding transformation is successful.
0106   //! Warning
0107   //! Nothing is done if:
0108   //! - the face F does not belong to the initial shape of this algorithm, or
0109   //! - the face F is not planar, cylindrical or conical.
0110   //! Exceptions
0111   //! - Standard_NullObject if the initial shape is not
0112   //! defined, i.e. if this algorithm has not been initialized
0113   //! with the non-empty constructor or the Init function.
0114   //! - Standard_ConstructionError if the previous call to
0115   //! Add has failed. The function AddDone ought to have
0116   //! been used to check for this, and the function Remove
0117   //! to cancel the results of the unsuccessful taper-adding
0118   //! transformation and to retrieve the previous shape.
0119   Standard_EXPORT void Add (const TopoDS_Face& F, const gp_Dir& Direction, const Standard_Real Angle, const gp_Pln& NeutralPlane, const Standard_Boolean Flag = Standard_True);
0120   
0121   //! Returns true if the previous taper-adding
0122   //! transformation performed by this algorithm in the last
0123   //! call to Add, was successful.
0124   //! If AddDone returns false:
0125   //! - the function ProblematicShape returns the face
0126   //! on which the error occurred,
0127   //! - the function Remove has to be used to cancel the
0128   //! results of the unsuccessful taper-adding
0129   //! transformation and to retrieve the previous shape.
0130   //! Exceptions
0131   //! Standard_NullObject if the initial shape has not
0132   //! been defined, i.e. if this algorithm has not been
0133   //! initialized with the non-empty constructor or the .Init function.
0134   Standard_EXPORT Standard_Boolean AddDone() const;
0135   
0136   //! Cancels the taper-adding transformation previously
0137   //! performed by this algorithm on the face F and the
0138   //! series of tangential faces which contain F, and retrieves
0139   //! the shape before the last taper-adding transformation.
0140   //! Warning
0141   //! You will have to use this function if the previous call to
0142   //! Add fails. Use the function AddDone to check it.
0143   //! Exceptions
0144   //! - Standard_NullObject if the initial shape has not
0145   //! been defined, i.e. if this algorithm has not been
0146   //! initialized with the non-empty constructor or the Init function.
0147   //! - Standard_NoSuchObject if F has not been added
0148   //! or has already been removed.
0149   Standard_EXPORT void Remove (const TopoDS_Face& F);
0150   
0151   //! Returns the shape on which an error occurred after an
0152   //! unsuccessful call to Add or when IsDone returns false.
0153   //! Exceptions
0154   //! Standard_NullObject if the initial shape has not been
0155   //! defined, i.e. if this algorithm has not been initialized with
0156   //! the non-empty constructor or the Init function.
0157   Standard_EXPORT const TopoDS_Shape& ProblematicShape() const;
0158   
0159   //! Returns an error  status when an error has occurred
0160   //! (Face,   Edge    or Vertex  recomputation problem).
0161   //! Otherwise returns Draft_NoError. The method may be
0162   //! called if AddDone  returns Standard_False, or when
0163   //! IsDone returns Standard_False.
0164   Standard_EXPORT Draft_ErrorStatus Status() const;
0165   
0166   //! Returns all  the  faces   which  have been   added
0167   //! together with the face <F>.
0168   Standard_EXPORT const TopTools_ListOfShape& ConnectedFaces (const TopoDS_Face& F) const;
0169   
0170   //! Returns all the faces  on which a modification has
0171   //! been given.
0172   Standard_EXPORT const TopTools_ListOfShape& ModifiedFaces() const;
0173   
0174   //! Builds the resulting shape (redefined from MakeShape).
0175   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0176   
0177   Standard_EXPORT void CorrectWires();
0178   
0179   //! Returns the  list   of shapes generated   from the
0180   //! shape <S>.
0181   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
0182   
0183   //! Returns the list  of shapes modified from the shape
0184   //! <S>.
0185   Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE;
0186 
0187   //! Returns the modified shape corresponding to <S>.
0188   //! S can correspond to the entire initial shape or to its subshape.
0189   //! Raises exceptions
0190   //! Standard_NoSuchObject if S is not the initial shape or
0191   //! a subshape of the initial shape to which the
0192   //! transformation has been applied. 
0193   Standard_EXPORT virtual TopoDS_Shape ModifiedShape (const TopoDS_Shape& S) const Standard_OVERRIDE;
0194 
0195 
0196 
0197 
0198 protected:
0199 
0200 
0201 
0202 
0203 
0204 private:
0205 
0206   Standard_EXPORT void CorrectVertexTol();
0207 
0208   TopTools_DataMapOfShapeShape myVtxToReplace;
0209   BRepTools_ReShape mySubs;
0210 };
0211 
0212 
0213 
0214 
0215 
0216 
0217 
0218 #endif // _BRepOffsetAPI_DraftAngle_HeaderFile