Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:16:55

0001 // Created on: 1996-09-03
0002 // Created by: Olga PILLOT
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 _BRepFeat_MakeDPrism_HeaderFile
0018 #define _BRepFeat_MakeDPrism_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopoDS_Shape.hxx>
0025 #include <NCollection_List.hxx>
0026 #include <TopTools_ShapeMapHasher.hxx>
0027 #include <NCollection_DataMap.hxx>
0028 #include <Standard_Real.hxx>
0029 #include <BRepFeat_StatusError.hxx>
0030 #include <BRepFeat_Form.hxx>
0031 #include <Standard_Integer.hxx>
0032 class Geom_Curve;
0033 class TopoDS_Shape;
0034 class TopoDS_Edge;
0035 
0036 //! Describes functions to build draft
0037 //! prism topologies from basis shape surfaces. These can be depressions or protrusions.
0038 //! The semantics of draft prism feature creation is based on the
0039 //! construction of shapes:
0040 //! -          along a length
0041 //! -          up to a limiting face
0042 //! -          from a limiting face to a height.
0043 //! The shape defining construction of the draft prism feature can be
0044 //! either the supporting edge or the concerned area of a face.
0045 //! In case of the supporting edge, this contour can be attached to a
0046 //! face of the basis shape by binding. When the contour is bound to this
0047 //! face, the information that the contour will slide on the face
0048 //! becomes available to the relevant class methods.
0049 //! In case of the concerned area of a face, you could, for example, cut
0050 //! it out and move it to a different height which will define the
0051 //! limiting face of a protrusion or depression.
0052 class BRepFeat_MakeDPrism : public BRepFeat_Form
0053 {
0054 public:
0055   DEFINE_STANDARD_ALLOC
0056 
0057   //! A face Pbase is selected in the shape
0058   //! Sbase to serve as the basis for the draft prism. The
0059   //! draft will be defined by the angle Angle and Fuse offers a choice between:
0060   //! - removing matter with a Boolean cut using the setting 0
0061   //! - adding matter with Boolean fusion using the setting 1.
0062   //! The sketch face Skface serves to determine the type of
0063   //! operation. If it is inside the basis shape, a local
0064   //! operation such as glueing can be performed.
0065   //! Initializes the draft prism class
0066   BRepFeat_MakeDPrism(const TopoDS_Shape& Sbase,
0067                       const TopoDS_Face&  Pbase,
0068                       const TopoDS_Face&  Skface,
0069                       const double        Angle,
0070                       const int           Fuse,
0071                       const bool          Modify)
0072   {
0073     Init(Sbase, Pbase, Skface, Angle, Fuse, Modify);
0074   }
0075 
0076   BRepFeat_MakeDPrism()
0077       : myAngle(RealLast()),
0078         myStatusError(BRepFeat_OK)
0079   {
0080   }
0081 
0082   //! Initializes this algorithm for building draft prisms along surfaces.
0083   //! A face Pbase is selected in the basis shape Sbase to
0084   //! serve as the basis from the draft prism. The draft will be
0085   //! defined by the angle Angle and Fuse offers a choice between:
0086   //! -   removing matter with a Boolean cut using the setting 0
0087   //! -   adding matter with Boolean fusion using the setting 1.
0088   //! The sketch face Skface serves to determine the type of
0089   //! operation. If it is inside the basis shape, a local
0090   //! operation such as glueing can be performed.
0091   Standard_EXPORT void Init(const TopoDS_Shape& Sbase,
0092                             const TopoDS_Face&  Pbase,
0093                             const TopoDS_Face&  Skface,
0094                             const double        Angle,
0095                             const int           Fuse,
0096                             const bool          Modify);
0097 
0098   //! Indicates that the edge <E> will slide on the face
0099   //! <OnFace>.
0100   //! Raises ConstructionError if the face does not belong to the
0101   //! basis shape, or the edge to the prismed shape.
0102   Standard_EXPORT void Add(const TopoDS_Edge& E, const TopoDS_Face& OnFace);
0103 
0104   Standard_EXPORT void Perform(const double Height);
0105 
0106   Standard_EXPORT void Perform(const TopoDS_Shape& Until);
0107 
0108   //! Assigns one of the following semantics
0109   //! -   to a height Height
0110   //! -   to a face Until
0111   //! -   from a face From to a height Until.
0112   //! Reconstructs the feature topologically according to the semantic option chosen.
0113   Standard_EXPORT void Perform(const TopoDS_Shape& From, const TopoDS_Shape& Until);
0114 
0115   //! Realizes a semi-infinite prism, limited by the position of the prism base.
0116   Standard_EXPORT void PerformUntilEnd();
0117 
0118   //! Realizes a semi-infinite prism, limited by the face Funtil.
0119   Standard_EXPORT void PerformFromEnd(const TopoDS_Shape& FUntil);
0120 
0121   //! Builds an infinite prism. The infinite descendants will not be kept in the result.
0122   Standard_EXPORT void PerformThruAll();
0123 
0124   //! Assigns both a limiting shape, Until from
0125   //! TopoDS_Shape, and a height, Height at which to stop
0126   //! generation of the prism feature.
0127   Standard_EXPORT void PerformUntilHeight(const TopoDS_Shape& Until, const double Height);
0128 
0129   Standard_EXPORT void Curves(NCollection_Sequence<occ::handle<Geom_Curve>>& S) override;
0130 
0131   Standard_EXPORT occ::handle<Geom_Curve> BarycCurve() override;
0132 
0133   //! Determination of TopEdges and LatEdges.
0134   //! sig = 1 -> TopEdges = FirstShape of the DPrism
0135   //! sig = 2 -> TOpEdges = LastShape of the DPrism
0136   Standard_EXPORT void BossEdges(const int sig);
0137 
0138   //! Returns the list of TopoDS Edges of the top of the boss.
0139   Standard_EXPORT const NCollection_List<TopoDS_Shape>& TopEdges();
0140 
0141   //! Returns the list of TopoDS Edges of the bottom of the boss.
0142   Standard_EXPORT const NCollection_List<TopoDS_Shape>& LatEdges();
0143 
0144 private:
0145   TopoDS_Face myPbase;
0146   NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0147                                                 mySlface;
0148   double                                        myAngle;
0149   NCollection_Sequence<occ::handle<Geom_Curve>> myCurves;
0150   occ::handle<Geom_Curve>                       myBCurve;
0151   NCollection_List<TopoDS_Shape>                myTopEdges;
0152   NCollection_List<TopoDS_Shape>                myLatEdges;
0153   BRepFeat_StatusError                          myStatusError;
0154 };
0155 
0156 #endif // _BRepFeat_MakeDPrism_HeaderFile