Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-07-08
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1993-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 _BRepBuilderAPI_MakeWire_HeaderFile
0018 #define _BRepBuilderAPI_MakeWire_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepLib_MakeWire.hxx>
0025 #include <BRepBuilderAPI_MakeShape.hxx>
0026 #include <TopTools_ListOfShape.hxx>
0027 #include <BRepBuilderAPI_WireError.hxx>
0028 class TopoDS_Edge;
0029 class TopoDS_Wire;
0030 class TopoDS_Vertex;
0031 
0032 
0033 //! Describes functions to build wires from edges. A wire can
0034 //! be built from any number of edges.
0035 //! To build a wire you first initialize the construction, then
0036 //! add edges in sequence. An unlimited number of edges
0037 //! can be added. The initialization of construction is done with:
0038 //! -   no edge (an empty wire), or
0039 //! -   edges of an existing wire, or
0040 //! -   up to four connectable edges.
0041 //! In order to be added to a wire under construction, an
0042 //! edge (unless it is the first one) must satisfy the following
0043 //! condition: one of its vertices must be geometrically
0044 //! coincident with one of the vertices of the wire (provided
0045 //! that the highest tolerance factor is assigned to the two
0046 //! vertices). It could also be the same vertex.
0047 //! -   The given edge is shared by the wire if it contains:
0048 //! -   two vertices, identical to two vertices of the wire
0049 //! under construction (a general case of the wire closure), or
0050 //! -   one vertex, identical to a vertex of the wire under
0051 //! construction; the other vertex not being
0052 //! geometrically coincident with another vertex of the wire.
0053 //! -   In other cases, when one of the vertices of the edge
0054 //! is simply geometrically coincident with a vertex of the
0055 //! wire under construction (provided that the highest
0056 //! tolerance factor is assigned to the two vertices), the
0057 //! given edge is first copied and the coincident vertex is
0058 //! replaced in this new edge, by the coincident vertex of the wire.
0059 //! Note: it is possible to build non manifold wires using this construction tool.
0060 //! A MakeWire object provides a framework for:
0061 //! -   initializing the construction of a wire,
0062 //! -   adding edges to the wire under construction, and
0063 //! -   consulting the result.
0064 class BRepBuilderAPI_MakeWire  : public BRepBuilderAPI_MakeShape
0065 {
0066 public:
0067 
0068   DEFINE_STANDARD_ALLOC
0069 
0070   
0071   //! Constructs an empty wire framework, to which edges
0072   //! are added using the Add function.
0073   //! As soon as the wire contains one edge, it can return
0074   //! with the use of the function Wire.
0075   //! Warning
0076   //! The function Error will return
0077   //! BRepBuilderAPI_EmptyWire if it is called before at
0078   //! least one edge is added to the wire under construction.
0079   Standard_EXPORT BRepBuilderAPI_MakeWire();
0080   
0081   //! Make a Wire from an edge.
0082   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E);
0083   
0084   //! Make a Wire from two edges.
0085   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, const TopoDS_Edge& E2);
0086   
0087   //! Make a Wire from three edges.
0088   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& E3);
0089   
0090   //! Make a Wire from four edges.
0091   //! Constructs a wire
0092   //! -   from the TopoDS_Wire W composed of the edge E, or
0093   //! -   from edge E, or
0094   //! -   from two edges E1 and E2, or
0095   //! -   from three edges E1, E2 and E3, or
0096   //! -   from four edges E1, E2, E3 and E4.
0097   //! Further edges can be added using the function Add.
0098   //! Given edges are added in a sequence. Each of them
0099   //! must be connectable to the wire under construction,
0100   //! and so must satisfy the following condition (unless it is
0101   //! the first edge of the wire): one of its vertices must be
0102   //! geometrically coincident with one of the vertices of the
0103   //! wire (provided that the highest tolerance factor is
0104   //! assigned to the two vertices). It could also be the same vertex.
0105   //! Warning
0106   //! If an edge is not connectable to the wire under
0107   //! construction it is not added. The function Error will
0108   //! return BRepBuilderAPI_DisconnectedWire, the
0109   //! function IsDone will return false and the function Wire
0110   //! will raise an error, until a new connectable edge is added.
0111   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& E3, const TopoDS_Edge& E4);
0112   
0113   //! Make a Wire from a Wire. useful for adding later.
0114   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Wire& W);
0115   
0116   //! Add an edge to a wire.
0117   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Wire& W, const TopoDS_Edge& E);
0118   
0119   //! Adds the edge E to the wire under construction.
0120   //! E must be connectable to the wire under construction, and, unless it
0121   //! is the first edge of the wire, must satisfy the following
0122   //! condition: one of its vertices must be geometrically coincident
0123   //! with one of the vertices of the wire (provided that the highest
0124   //! tolerance factor is assigned to the two vertices). It could also
0125   //! be the same vertex.
0126   //! Warning
0127   //! If E is not connectable to the wire under construction it is not
0128   //! added. The function Error will return
0129   //! BRepBuilderAPI_DisconnectedWire, the function IsDone will return
0130   //! false and the function Wire will raise an error, until a new
0131   //! connectable edge is added.
0132   Standard_EXPORT void Add (const TopoDS_Edge& E);
0133   
0134   //! Add the edges of <W> to the current wire.
0135   Standard_EXPORT void Add (const TopoDS_Wire& W);
0136   
0137   //! Adds  the edges of <L>   to the current  wire.  The
0138   //! edges are not to be consecutive.   But they are to
0139   //! be  all  connected geometrically or topologically.
0140   //! If some of them are  not connected the Status give
0141   //! DisconnectedWire but the "Maker" is Done() and you
0142   //! can get the  partial result. (ie connected to  the
0143   //! first edgeof the list <L>)
0144   Standard_EXPORT void Add (const TopTools_ListOfShape& L);
0145   
0146   //! Returns true if this algorithm contains a valid wire.
0147   //! IsDone returns false if:
0148   //! -   there are no edges in the wire, or
0149   //! -   the last edge which you tried to add was not connectable.
0150   Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE;
0151   
0152   //! Returns the construction status
0153   //! -   BRepBuilderAPI_WireDone if the wire is built, or
0154   //! -   another value of the BRepBuilderAPI_WireError
0155   //! enumeration indicating why the construction failed.
0156   Standard_EXPORT BRepBuilderAPI_WireError Error() const;
0157   
0158   //! Returns the constructed wire; or the part of the wire
0159   //! under construction already built.
0160   //! Exceptions StdFail_NotDone if a wire is not built.
0161   Standard_EXPORT const TopoDS_Wire& Wire();
0162   Standard_EXPORT operator TopoDS_Wire();
0163   
0164   //! Returns the last edge added to the wire under construction.
0165   //! Warning
0166   //! -   This edge can be different from the original one (the
0167   //! argument of the function Add, for instance,)
0168   //! -   A null edge is returned if there are no edges in the
0169   //! wire under construction, or if the last edge which you
0170   //! tried to add was not connectable..
0171   Standard_EXPORT const TopoDS_Edge& Edge() const;
0172   
0173   //! Returns the last vertex of the last edge added to the
0174   //! wire under construction.
0175   //! Warning
0176   //! A null vertex is returned if there are no edges in the wire
0177   //! under construction, or if the last edge which you tried to
0178   //! add was not connectableR
0179   Standard_EXPORT const TopoDS_Vertex& Vertex() const;
0180 
0181 
0182 
0183 
0184 protected:
0185 
0186 
0187 
0188 
0189 
0190 private:
0191 
0192 
0193 
0194   BRepLib_MakeWire myMakeWire;
0195 
0196 
0197 };
0198 
0199 
0200 
0201 
0202 
0203 
0204 
0205 #endif // _BRepBuilderAPI_MakeWire_HeaderFile