b311480e |
1 | -- Created on: 1998-06-03 |
2 | -- Created by: Daniel RISSER |
3 | -- Copyright (c) 1998-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | -- Modified Mon Sep 14 10:20:25 1998 by Roman LYGIN (rln) |
22 | -- 1. Analysis of actual free bounds of the shells. |
23 | -- 2. Options to extract closed sub-wires out of closed and open |
24 | -- wires |
25 | -- 3. Improved algorithm for connecting free edges into wires |
26 | |
27 | |
28 | class FreeBounds from ShapeAnalysis |
29 | |
30 | ---Purpose: This class is intended to output free bounds of the shape |
31 | -- (free bounds are the wires consisting of edges referenced by the |
32 | -- only face). |
33 | -- This class works on two distinct types of shapes when analyzing |
34 | -- their free bounds: |
35 | -- 1. compound of faces. |
36 | -- Analyzer of sewing algorithm (BRepAlgo_Sewing) is used for |
37 | -- for forecasting free bounds that would be obtained after |
38 | -- performing sewing |
39 | -- 2. compound of shells. |
40 | -- Actual free bounds (edges shared by the only face in the shell) |
41 | -- are output in this case. ShapeAnalysis_Shell is used for that. |
42 | -- |
43 | -- When connecting edges into the wires algorithm tries to build |
44 | -- wires of maximum length. Two options are provided for a user |
45 | -- to extract closed sub-contours out of closed and/or open contours. |
46 | -- |
47 | -- Free bounds are returned as two compounds, one for closed and one |
48 | -- for open wires. |
49 | -- |
50 | -- This class also provides some static methods for advanced use: |
51 | -- connecting edges/wires to wires, extracting closed sub-wires out |
52 | -- of wires, dispatching wires into compounds for closed and open |
53 | -- wires. |
54 | -- NOTE. Ends of the edge or wire mean hereafter their end vertices. |
55 | |
56 | |
57 | uses |
58 | Shape from TopoDS, |
59 | Vertex from TopoDS, |
60 | Wire from TopoDS, |
61 | Compound from TopoDS, |
62 | HSequenceOfShape from TopTools, |
63 | DataMapOfShapeShape from TopTools, |
64 | HArray1OfShape from TopTools |
65 | |
66 | is |
67 | Create returns FreeBounds from ShapeAnalysis; |
68 | ---Purpose: Empty constructor |
69 | |
70 | Create (shape : Shape from TopoDS; |
71 | toler : Real; |
72 | splitclosed: Boolean = Standard_False; |
73 | splitopen : Boolean = Standard_True) |
74 | returns FreeBounds from ShapeAnalysis; |
75 | ---Purpose: Builds forecasting free bounds of the <shape>. |
76 | -- <shape> should be a compound of faces. |
77 | -- This constructor is to be used for forecasting free edges |
78 | -- with help of sewing analyzer BRepAlgo_Sewing which is called |
79 | -- with tolerance <toler>. |
80 | -- Free edges are connected into wires only when their ends are |
81 | -- at distance less than <toler>. |
82 | -- If <splitclosed> is True extracts closed sub-wires out of |
83 | -- built closed wires. |
84 | -- If <splitopen> is True extracts closed sub-wires out of |
85 | -- built open wires. |
86 | |
87 | Create (shape : Shape from TopoDS; |
88 | splitclosed: Boolean = Standard_False; |
89 | splitopen : Boolean = Standard_True; |
90 | checkinternaledges : Boolean = Standard_False) |
91 | returns FreeBounds from ShapeAnalysis; |
92 | ---Purpose: Builds actual free bounds of the <shape>. |
93 | -- <shape> should be a compound of shells. |
94 | -- This constructor is to be used for getting free edges (ones |
95 | -- referenced by the only face) with help of analyzer |
96 | -- ShapeAnalysis_Shell. |
97 | -- Free edges are connected into wires only when they share the |
98 | -- same vertex. |
99 | -- If <splitclosed> is True extracts closed sub-wires out of |
100 | -- built closed wires. |
101 | -- If <splitopen> is True extracts closed sub-wires out of |
102 | -- built open wires. |
103 | |
104 | GetClosedWires (me) returns Compound from TopoDS; |
105 | ---Purpose: Returns compound of closed wires out of free edges. |
106 | ---C++: inline |
107 | ---C++: return const & |
108 | |
109 | GetOpenWires (me) returns Compound from TopoDS; |
110 | ---Purpose: Returns compound of open wires out of free edges. |
111 | ---C++: inline |
112 | ---C++: return const & |
113 | |
114 | |
115 | |
116 | ---Level: Advanced |
117 | |
118 | ConnectEdgesToWires (myclass; edges : in out HSequenceOfShape from TopTools; |
119 | toler : Real; |
120 | shared: Boolean; |
121 | wires : out HSequenceOfShape from TopTools); |
122 | ---Purpose: Builds sequnce of <wires> out of sequence of not sorted |
123 | -- <edges>. |
124 | -- Tries to build wires of maximum length. Building a wire is |
125 | -- stopped when no edges can be connected to it at its head or |
126 | -- at its tail. |
127 | -- |
128 | -- Orientation of the edge can change when connecting. |
129 | -- If <shared> is True connection is performed only when |
130 | -- adjacent edges share the same vertex. |
131 | -- If <shared> is False connection is performed only when |
132 | -- ends of adjacent edges are at distance less than <toler>. |
133 | |
134 | ConnectWiresToWires (myclass; iwires: in out HSequenceOfShape from TopTools; |
135 | toler : Real; |
136 | shared: Boolean; |
137 | owires: out HSequenceOfShape from TopTools); |
138 | |
139 | ConnectWiresToWires (myclass; iwires: in out HSequenceOfShape from TopTools; |
140 | toler : Real; |
141 | shared: Boolean; |
142 | owires: out HSequenceOfShape from TopTools; |
143 | vertices: out DataMapOfShapeShape |
144 | from TopTools); |
145 | ---Purpose: Builds sequnce of <owires> out of sequence of not sorted |
146 | -- <iwires>. |
147 | -- Tries to build wires of maximum length. Building a wire is |
148 | -- stopped when no wires can be connected to it at its head or |
149 | -- at its tail. |
150 | -- |
151 | -- Orientation of the wire can change when connecting. |
152 | -- If <shared> is True connection is performed only when |
153 | -- adjacent wires share the same vertex. |
154 | -- If <shared> is False connection is performed only when |
155 | -- ends of adjacent wires are at distance less than <toler>. |
156 | -- Map <vertices> stores the correspondence between original |
157 | -- end vertices of the wires and new connecting vertices. |
158 | |
159 | SplitWires (myclass; wires : HSequenceOfShape from TopTools; |
160 | toler : Real; |
161 | shared: Boolean; |
162 | closed: out HSequenceOfShape from TopTools; |
163 | open : out HSequenceOfShape from TopTools); |
164 | ---Purpose: Extracts closed sub-wires out of <wires> and adds them |
165 | -- to <closed>, open wires remained after extraction are put |
166 | -- into <open>. |
167 | -- If <shared> is True extraction is performed only when |
168 | -- edges share the same vertex. |
169 | -- If <shared> is False connection is performed only when |
170 | -- ends of the edges are at distance less than <toler>. |
171 | |
172 | DispatchWires (myclass; wires : HSequenceOfShape from TopTools; |
173 | closed: in out Compound from TopoDS; |
174 | open : in out Compound from TopoDS); |
175 | ---Purpose: Dispatches sequence of <wires> into two compounds |
176 | -- <closed> for closed wires and <open> for open wires. |
177 | -- If a compound is not empty wires are added into it. |
178 | |
179 | |
180 | ---Level: Internal |
181 | |
182 | SplitWires (me: in out) is private; |
183 | |
184 | |
185 | fields |
186 | |
187 | myWires: Compound from TopoDS; |
188 | myEdges: Compound from TopoDS; |
189 | |
190 | myTolerance : Real; |
191 | myShared : Boolean; |
192 | |
193 | mySplitClosed: Boolean; |
194 | mySplitOpen : Boolean; |
195 | |
196 | end FreeBounds; |