1 -- Created on: 1998-06-03
2 -- Created by: Daniel RISSER
3 -- Copyright (c) 1998-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 -- Modified Mon Sep 14 10:20:25 1998 by Roman LYGIN (rln)
18 -- 1. Analysis of actual free bounds of the shells.
19 -- 2. Options to extract closed sub-wires out of closed and open
21 -- 3. Improved algorithm for connecting free edges into wires
24 class FreeBounds from ShapeAnalysis
26 ---Purpose: This class is intended to output free bounds of the shape
27 -- (free bounds are the wires consisting of edges referenced by the
29 -- This class works on two distinct types of shapes when analyzing
31 -- 1. compound of faces.
32 -- Analyzer of sewing algorithm (BRepAlgo_Sewing) is used for
33 -- for forecasting free bounds that would be obtained after
35 -- 2. compound of shells.
36 -- Actual free bounds (edges shared by the only face in the shell)
37 -- are output in this case. ShapeAnalysis_Shell is used for that.
39 -- When connecting edges into the wires algorithm tries to build
40 -- wires of maximum length. Two options are provided for a user
41 -- to extract closed sub-contours out of closed and/or open contours.
43 -- Free bounds are returned as two compounds, one for closed and one
46 -- This class also provides some static methods for advanced use:
47 -- connecting edges/wires to wires, extracting closed sub-wires out
48 -- of wires, dispatching wires into compounds for closed and open
50 -- NOTE. Ends of the edge or wire mean hereafter their end vertices.
58 HSequenceOfShape from TopTools,
59 DataMapOfShapeShape from TopTools,
60 HArray1OfShape from TopTools
63 Create returns FreeBounds from ShapeAnalysis;
64 ---Purpose: Empty constructor
66 Create (shape : Shape from TopoDS;
68 splitclosed: Boolean = Standard_False;
69 splitopen : Boolean = Standard_True)
70 returns FreeBounds from ShapeAnalysis;
71 ---Purpose: Builds forecasting free bounds of the <shape>.
72 -- <shape> should be a compound of faces.
73 -- This constructor is to be used for forecasting free edges
74 -- with help of sewing analyzer BRepAlgo_Sewing which is called
75 -- with tolerance <toler>.
76 -- Free edges are connected into wires only when their ends are
77 -- at distance less than <toler>.
78 -- If <splitclosed> is True extracts closed sub-wires out of
79 -- built closed wires.
80 -- If <splitopen> is True extracts closed sub-wires out of
83 Create (shape : Shape from TopoDS;
84 splitclosed: Boolean = Standard_False;
85 splitopen : Boolean = Standard_True;
86 checkinternaledges : Boolean = Standard_False)
87 returns FreeBounds from ShapeAnalysis;
88 ---Purpose: Builds actual free bounds of the <shape>.
89 -- <shape> should be a compound of shells.
90 -- This constructor is to be used for getting free edges (ones
91 -- referenced by the only face) with help of analyzer
92 -- ShapeAnalysis_Shell.
93 -- Free edges are connected into wires only when they share the
95 -- If <splitclosed> is True extracts closed sub-wires out of
96 -- built closed wires.
97 -- If <splitopen> is True extracts closed sub-wires out of
100 GetClosedWires (me) returns Compound from TopoDS;
101 ---Purpose: Returns compound of closed wires out of free edges.
103 ---C++: return const &
105 GetOpenWires (me) returns Compound from TopoDS;
106 ---Purpose: Returns compound of open wires out of free edges.
108 ---C++: return const &
114 ConnectEdgesToWires (myclass; edges : in out HSequenceOfShape from TopTools;
117 wires : out HSequenceOfShape from TopTools);
118 ---Purpose: Builds sequnce of <wires> out of sequence of not sorted
120 -- Tries to build wires of maximum length. Building a wire is
121 -- stopped when no edges can be connected to it at its head or
124 -- Orientation of the edge can change when connecting.
125 -- If <shared> is True connection is performed only when
126 -- adjacent edges share the same vertex.
127 -- If <shared> is False connection is performed only when
128 -- ends of adjacent edges are at distance less than <toler>.
130 ConnectWiresToWires (myclass; iwires: in out HSequenceOfShape from TopTools;
133 owires: out HSequenceOfShape from TopTools);
135 ConnectWiresToWires (myclass; iwires: in out HSequenceOfShape from TopTools;
138 owires: out HSequenceOfShape from TopTools;
139 vertices: out DataMapOfShapeShape
141 ---Purpose: Builds sequnce of <owires> out of sequence of not sorted
143 -- Tries to build wires of maximum length. Building a wire is
144 -- stopped when no wires can be connected to it at its head or
147 -- Orientation of the wire can change when connecting.
148 -- If <shared> is True connection is performed only when
149 -- adjacent wires share the same vertex.
150 -- If <shared> is False connection is performed only when
151 -- ends of adjacent wires are at distance less than <toler>.
152 -- Map <vertices> stores the correspondence between original
153 -- end vertices of the wires and new connecting vertices.
155 SplitWires (myclass; wires : HSequenceOfShape from TopTools;
158 closed: out HSequenceOfShape from TopTools;
159 open : out HSequenceOfShape from TopTools);
160 ---Purpose: Extracts closed sub-wires out of <wires> and adds them
161 -- to <closed>, open wires remained after extraction are put
163 -- If <shared> is True extraction is performed only when
164 -- edges share the same vertex.
165 -- If <shared> is False connection is performed only when
166 -- ends of the edges are at distance less than <toler>.
168 DispatchWires (myclass; wires : HSequenceOfShape from TopTools;
169 closed: in out Compound from TopoDS;
170 open : in out Compound from TopoDS);
171 ---Purpose: Dispatches sequence of <wires> into two compounds
172 -- <closed> for closed wires and <open> for open wires.
173 -- If a compound is not empty wires are added into it.
178 SplitWires (me: in out) is private;
183 myWires: Compound from TopoDS;
184 myEdges: Compound from TopoDS;
189 mySplitClosed: Boolean;
190 mySplitOpen : Boolean;