Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:21:27

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 <TopoDS_Shape.hxx>
0027 #include <NCollection_List.hxx>
0028 #include <BRepBuilderAPI_WireError.hxx>
0029 class TopoDS_Edge;
0030 class TopoDS_Wire;
0031 class TopoDS_Vertex;
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   DEFINE_STANDARD_ALLOC
0068 
0069   //! Constructs an empty wire framework, to which edges
0070   //! are added using the Add function.
0071   //! As soon as the wire contains one edge, it can return
0072   //! with the use of the function Wire.
0073   //! Warning
0074   //! The function Error will return
0075   //! BRepBuilderAPI_EmptyWire if it is called before at
0076   //! least one edge is added to the wire under construction.
0077   Standard_EXPORT BRepBuilderAPI_MakeWire();
0078 
0079   //! Make a Wire from an edge.
0080   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E);
0081 
0082   //! Make a Wire from two edges.
0083   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1, const TopoDS_Edge& E2);
0084 
0085   //! Make a Wire from three edges.
0086   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Edge& E1,
0087                                           const TopoDS_Edge& E2,
0088                                           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,
0112                                           const TopoDS_Edge& E2,
0113                                           const TopoDS_Edge& E3,
0114                                           const TopoDS_Edge& E4);
0115 
0116   //! Make a Wire from a Wire. useful for adding later.
0117   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Wire& W);
0118 
0119   //! Add an edge to a wire.
0120   Standard_EXPORT BRepBuilderAPI_MakeWire(const TopoDS_Wire& W, const TopoDS_Edge& E);
0121 
0122   //! Adds the edge E to the wire under construction.
0123   //! E must be connectable to the wire under construction, and, unless it
0124   //! is the first edge of the wire, must satisfy the following
0125   //! condition: one of its vertices must be geometrically coincident
0126   //! with one of the vertices of the wire (provided that the highest
0127   //! tolerance factor is assigned to the two vertices). It could also
0128   //! be the same vertex.
0129   //! Warning
0130   //! If E is not connectable to the wire under construction it is not
0131   //! added. The function Error will return
0132   //! BRepBuilderAPI_DisconnectedWire, the function IsDone will return
0133   //! false and the function Wire will raise an error, until a new
0134   //! connectable edge is added.
0135   Standard_EXPORT void Add(const TopoDS_Edge& E);
0136 
0137   //! Add the edges of <W> to the current wire.
0138   Standard_EXPORT void Add(const TopoDS_Wire& W);
0139 
0140   //! Adds the edges of <L> to the current wire. The
0141   //! edges are not to be consecutive. But they are to
0142   //! be all connected geometrically or topologically.
0143   //! If some of them are not connected the Status give
0144   //! DisconnectedWire but the "Maker" is Done() and you
0145   //! can get the partial result.
0146   //! (i.e. connected to the first edgeof the list <L>)
0147   Standard_EXPORT void Add(const NCollection_List<TopoDS_Shape>& L);
0148 
0149   //! Returns true if this algorithm contains a valid wire.
0150   //! IsDone returns false if:
0151   //! -   there are no edges in the wire, or
0152   //! -   the last edge which you tried to add was not connectable.
0153   Standard_EXPORT bool IsDone() const override;
0154 
0155   //! Returns the construction status
0156   //! -   BRepBuilderAPI_WireDone if the wire is built, or
0157   //! -   another value of the BRepBuilderAPI_WireError
0158   //! enumeration indicating why the construction failed.
0159   Standard_EXPORT BRepBuilderAPI_WireError Error() const;
0160 
0161   //! Returns the constructed wire; or the part of the wire
0162   //! under construction already built.
0163   //! Exceptions StdFail_NotDone if a wire is not built.
0164   Standard_EXPORT const TopoDS_Wire& Wire();
0165   Standard_EXPORT                    operator TopoDS_Wire();
0166 
0167   //! Returns the last edge added to the wire under construction.
0168   //! Warning
0169   //! -   This edge can be different from the original one (the
0170   //! argument of the function Add, for instance,)
0171   //! -   A null edge is returned if there are no edges in the
0172   //! wire under construction, or if the last edge which you
0173   //! tried to add was not connectable..
0174   Standard_EXPORT const TopoDS_Edge& Edge() const;
0175 
0176   //! Returns the last vertex of the last edge added to the
0177   //! wire under construction.
0178   //! Warning
0179   //! A null vertex is returned if there are no edges in the wire
0180   //! under construction, or if the last edge which you tried to
0181   //! add was not connectableR
0182   Standard_EXPORT const TopoDS_Vertex& Vertex() const;
0183 
0184 private:
0185   BRepLib_MakeWire myMakeWire;
0186 };
0187 
0188 #endif // _BRepBuilderAPI_MakeWire_HeaderFile