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