0027270: Boolean operations: incorrect assembling of sub-shapes in container shapes...
[occt.git] / dox / user_guides / boolean_operations / boolean_operations.md
CommitLineData
1a457208 1Boolean Operations {#occt_user_guides__boolean_operations}
2=========================
3
4@tableofcontents
5
6@section occt_algorithms_1 Introduction
7
e9e33e91 8This document provides a comprehensive description of the Boolean Operation Algorithm (BOA) as it is implemented in Open CASCADE Technology. The Boolean Component contains:
1a457208 9
e9e33e91 10* General Fuse Operator (GFA),
11* Boolean Operator (BOA),
12* Section Operator (SA),
13* Partition Operator (PA).
e2b55410 14
e9e33e91 15GFA is the base algorithm for BOA, PA, SA.
e2b55410 16
e9e33e91 17GFA has a history-based architecture designed to allow using OCAF naming functionality. The architecture of GFA is expandable, that allows creating new algorithms basing on it.
e2b55410 18
e2b55410 19
1a457208 20@section occt_algorithms_2 Overview
21
22@subsection occt_algorithms_2_1 Operators
23
24@subsubsection occt_algorithms_2_1_1 Boolean operator
25
e9e33e91 26The Boolean operator provides the operations (Common, Fuse, Cut) between two groups: *Objects* and *Tools*. Each group consists of an arbitrary number of arguments in terms of *TopoDS_Shape*.
1a457208 27
28The operator can be represented as:
29
e9e33e91 30<i>R<sub>B</sub>=B<sub>j</sub> (G<sub>1</sub>, G<sub>2</sub>),</i>
1a457208 31
32where:
3f812249 33* *R<sub>B</sub>* -- result of the operation;
34* *B<sub>j</sub>* -- operation of type *j* (Common, Fuse, Cut);
e9e33e91 35* *G<sub>1</sub>={S<sub>11</sub>, S<sub>12</sub> ... S<sub>1n1</sub>}* group of arguments (Objects);
36* *G<sub>2</sub>={S<sub>21</sub>, S<sub>22</sub> ... S<sub>2n2</sub>}* group of arguments (Tools);
3f812249 37* *n<sub>1</sub>* -- Number of arguments in *Objects* group;
38* *n<sub>2</sub>* -- Number of arguments in *Tools* group.
e9e33e91 39
40
41**Note** There is an operation *Cut21*, which is an extension for forward Cut operation, i.e <i>Cut21=Cut(G2, G1)</i>.
1a457208 42
43@subsubsection occt_algorithms_2_1_2 General Fuse operator
44
45The General fuse operator can be applied to an arbitrary number of arguments in terms of *TopoDS_Shape*.
46
47The GFA operator can be represented as:
48
49<i>R<sub>GF</sub> = GF (S<sub>1</sub>, S<sub>2</sub> ... S<sub>n</sub>), </i>
50
51where
3f812249 52* *R<sub>GF</sub>* -- result of the operation,
53* *S<sub>1</sub>, S<sub>2</sub> ... S<sub>n</sub>* -- arguments of the operation,
54* *n* -- number of arguments.
1a457208 55
56The result of the Boolean operator, *R<sub>B</sub>*, can be obtained from *R<sub>GF</sub>*.
57
58For example, for two arguments *S<sub>1</sub>* and *S<sub>2</sub>* the result *R<sub>GF</sub>* is
59
60<i>R<sub>GF</sub> = GF (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub> + S<sub>p2</sub> + S<sub>p12</sub></i>
61
62@figure{/user_guides/boolean_operations/images/operations_image001.svg, "Operators"}
63
64This Figure shows that
65* <i>B<sub>common</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p12</sub>;</i>
66* <i>B<sub>cut12</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub>;</i>
67* <i>B<sub>cut21</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p2</sub>;</i>
e9e33e91 68* <i>B<sub>fuse</sub> (S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub>+S<sub>p2</sub>+S<sub>p12</sub></i>
1a457208 69
70<i>R<sub>GF</sub>=GF (S<sub>1</sub>, S<sub>2</sub>) = B<sub>fuse</sub> = B<sub>common</sub>+ B<sub>cut12</sub>+ B<sub>cut21</sub>.</i>
71
72The fact that *R<sub>GF</sub>* contains the components of *R<sub>B</sub>* allows considering GFA as the general case of BOA. So it is possible to implement BOA as a subclass of GFA.
73
74@subsubsection occt_algorithms_2_1_3 Partition operator
75
76The Partition operator can be applied to an arbitrary number of arguments in terms of *TopoDS_Shape*. The arguments are divided on two groups: Objects, Tools. The result of PA contains all parts belonging to the Objects but does not contain the parts that belongs to the Tools only.
77
78The PA operator can be represented as follows:
79
e9e33e91 80<i>R<sub>PA</sub>=PA (G<sub>1</sub>, G<sub>2</sub>),</i>
1a457208 81where:
3f812249 82* <i>R<sub>PA</sub></i> -- is the result of the operation;
e9e33e91 83* *G<sub>1</sub>={S<sub>11</sub>, S<sub>12</sub> ... S<sub>1n1</sub>}* group of arguments (Objects);
84* *G<sub>2</sub>={S<sub>21</sub>, S<sub>22</sub> ... S<sub>2n2</sub>}* group of arguments (Tools);
3f812249 85* *n<sub>1</sub>* -- Number of arguments in *Objects* group;
86* *n<sub>2</sub>* -- Number of arguments in *Tools* group.
1a457208 87
e9e33e91 88The result *R<sub>PA</sub>* can be obtained from *R<sub>GF</sub>* .
1a457208 89
e9e33e91 90For example, for two arguments *S<sub>1</sub>* and *S<sub>2</sub>* the result *R<sub>PA</sub>* is
1a457208 91
e9e33e91 92<i>R<sub>PA</sub>=PA(S<sub>1</sub>,S<sub>2</sub>)=S<sub>p1</sub>+S<sub>p12</sub>.</i>
1a457208 93
94In case when all arguments of the PA are Objects (no Tools), the result of PA is equivalent to the result of GFA.
95
e9e33e91 96For example, when *G<sub>1</sub>* consists of shapes *S<sub>1</sub>* and *S<sub>2</sub>* the result of *R<sub>PA</sub>* is
1a457208 97
e9e33e91 98<i>R<sub>PA</sub>=PA(S<sub>1</sub>, S<sub>2</sub>) = S<sub>p1</sub> + S<sub>p2</sub> + S<sub>p12</sub> = GF (S<sub>1</sub>, S<sub>2</sub>)</i>
1a457208 99
e9e33e91 100The fact that the *R<sub>GF</sub>* contains the components of *R<sub>PA</sub>* allows considering GFA as the general case of PA. Thus, it is possible to implement PA as a subclass of GFA.
101
102
103@subsubsection occt_algorithms_2_1_4 Section operator
104
105The Section operator *SA* can be applied to arbitrary number of arguments in terms of *TopoDS_Shape*. The result of *SA* contains vertices and edges in accordance with interferences between the arguments
106The SA operator can be represented as follows:
107<i>R<sub>SA</sub>=SA(S1, S2… Sn)</i>, where
3f812249 108* <i>R<sub>SA</sub></i> -- the operation result;
109* <i>S1, S2 ... Sn</i> -- the operation arguments;
110* *n* -- the number of arguments.
1a457208 111
112@subsection occt_algorithms_2_2 Parts of algorithms
113
e9e33e91 114GFA, BOA, PA and SA have the same Data Structure (DS). The main goal of the Data Structure is to store all necessary information for input data and intermediate results.
1a457208 115
e9e33e91 116The operators consist of two main parts:
1a457208 117* Intersection Part (IP). The main goal of IP is to compute the interferences between sub-shapes of arguments. The IP uses DS to retrieve input data and store the results of intersections.
118* Building Part (BP). The main goal of BP is to build required result of an operation. This part also uses DS to retrieve data and store the results.
119
e9e33e91 120As it follows from the definition of operator results, the main differences between GFA, BOA, PA and SA are in the Building Part. The Intersection Part is the same for the algorithms.
1a457208 121
122@section occt_algorithms_3 Terms and Definitions
123
124This chapter provides the background terms and definitions that are necessary to understand how the algorithms work.
125
126@subsection occt_algorithms_3_1 Interferences
127
e9e33e91 128There are two groups of interferences.
129
3f812249 130At first, each shape having a boundary representation (vertex, edge, face) has an internal value of geometrical tolerance. The shapes interfere with each other in terms of their tolerances. The shapes that have a boundary representation interfere when there is a part of 3D space where the distance between the underlying geometry of shapes is less or equal to the sum of tolerances of the shapes. Three types of shapes: vertex, edge and face -- produce six types of **BRep interferences:**
e9e33e91 131* Vertex/Vertex,
132* Vertex/Edge,
133* Vertex/Face,
134* Edge/Edge,
135* Edge/Face and
136* Face/Face.
1a457208 137
e9e33e91 138At second, there are interferences that occur between a solid *Z1* and a shape *S2* when *Z1* and *S2* have no BRep interferences but *S2* is completely inside of *Z1*. These interferences are **Non-BRep interferences**. There are four possible cases:
139* Vertex/Solid,
140* Edge/Solid,
141* Face/Solid and
142* Solid/Solid.
1a457208 143
144@subsubsection occt_algorithms_3_1_1 Vertex/Vertex interference
145
e9e33e91 146For two vertices *Vi* and *Vj*, the distance between their corresponding 3D points is less than the sum of their tolerances *Tol(Vi)* and *Tol(Vj)*.
1a457208 147
148@figure{/user_guides/boolean_operations/images/operations_image002.svg, "Vertex/vertex interference"}
149
e9e33e91 150The result is a new vertex *Vn* with 3D point *Pn* and tolerance value <i>Tol(Vn)</i>.
1a457208 151
e9e33e91 152The coordinates of *Pn* and the value <i>Tol(Vn)</i> are computed as the center and the radius of the sphere enclosing the tolerance spheres of the source vertices <i>(V1, V2)</i>.
1a457208 153
154@subsubsection occt_algorithms_3_1_2 Vertex/Edge interference
155
e9e33e91 156For a vertex *Vi* and an edge *Ej*, the distance *D* between 3D point of the vertex and its projection on the 3D curve of edge *Ej* is less or equal than sum of tolerances of vertex *Tol(Vi)* and edge *Tol(Ej)*.
1a457208 157
158@figure{/user_guides/boolean_operations/images/operations_image003.svg, "Vertex/edge interference"}
159
e9e33e91 160The result is vertex *Vi* with the corresponding tolerance value <i>Tol(Vi)=Max(Tol(Vi), D+Tol(Ej))</i>, where <i>D = distance (Pi, PPi)</i>;
1a457208 161
162and parameter *t<sub>i</sub>* of the projected point *PPi* on 3D curve *Cj* of edge *Ej*.
163
164@subsubsection occt_algorithms_3_1_3 Vertex/Face interference
165
166For a vertex *Vi* and a face *Fj* the distance *D* between 3D point of the vertex and its projection on the surface of the face is less or equal than sum of tolerances of the vertex *Tol(Vi)* and the face *Tol(Fj)*.
167
168@figure{/user_guides/boolean_operations/images/operations_image004.svg, "Vertex/face interference"}
169
e9e33e91 170The result is vertex *Vi* with the corresponding tolerance value <i>Tol(Vi)=Max(Tol(Vi), D+Tol(Fj))</i>, where <i>D = distance (Pi, PPi)</i>
1a457208 171
e9e33e91 172and parameters <i>u<sub>i</sub>, v<sub>i</sub></i> of the projected point *PPi* on surface *Sj* of face *Fj*.
1a457208 173
174@subsubsection occt_algorithms_3_1_4 Edge/Edge interference
175
176For two edges *Ei* and *Ej* (with the corresponding 3D curves *Ci* and *Cj*) there are some places where the distance between the curves is less than (or equal to) sum of tolerances of the edges.
177
178Let us examine two cases:
179
180In the first case two edges have one or several common parts of 3D curves in terms of tolerance.
181
182@figure{/user_guides/boolean_operations/images/operations_image005.svg, "Edge/edge interference: common parts"}
183
184The results are:
185* Parametric range <i>[t<sub>i1</sub>, t<sub>i2</sub> ]</i> for 3D curve *Ci* of edge *Ei*.
186* Parametric range <i>[t<sub>j1</sub>, t<sub>j2</sub> ]</i> for 3D curve *Cj* of edge *Ej*.
187
188In the second case two edges have one or several common points in terms of tolerance.
189
190@image html /user_guides/boolean_operations/images/operations_image006.svg "Edge/edge interference: common points"
191@image latex /user_guides/boolean_operations/images/operations_image006.svg "Edge/edge interference: common points"
192
e9e33e91 193The result is a new vertex *Vn* with 3D point *Pn* and tolerance value *Tol(Vn)*.
1a457208 194
e9e33e91 195The coordinates of *Pn* and the value *Tol(Vn)* are computed as the center and the radius of the sphere enclosing the tolerance spheres of the corresponding nearest points *Pi*, *Pj* of 3D curves *Ci*, *Cj* of source edges *Ei*, *Ej*.
1a457208 196
197* Parameter *t<sub>i</sub>* of *Pi* for the 3D curve *Ci*.
198* Parameter *t<sub>j</sub>* of *Pj* for the 3D curve *Cj*.
199
200@subsubsection occt_algorithms_3_1_5 Edge/Face interference
201
202For an edge *Ei* (with the corresponding 3D curve *Ci*) and a face *Fj* (with the corresponding 3D surface *Sj*) there are some places in 3D space, where the distance between *Ci* and surface *Sj* is less than (or equal to) the sum of tolerances of edge *Ei* and face *Fj*.
203
204Let us examine two cases:
205
206In the first case Edge *Ei* and Face *Fj* have one or several common parts in terms of tolerance.
207
208@figure{/user_guides/boolean_operations/images/operations_image007.svg, "Edge/face interference: common parts"}
209
210The result is a parametric range <i>[t<sub>i1</sub>, t<sub>i2</sub>]</i> for the 3D curve *Ci* of the edge *Ei*.
211
212In the second case Edge *Ei* and Face *Fj* have one or several common points in terms of tolerance.
213
214@figure{/user_guides/boolean_operations/images/operations_image008.svg, "Edge/face interference: common points"}
215
e9e33e91 216The result is a new vertex *Vn* with 3D point *Pn* and tolerance value *Tol(Vn)*.
217
218The coordinates of *Pn* and the value *Tol(Vn)* are computed as the center and the radius of the sphere enclosing the tolerance spheres of the corresponding nearest points *Pi*, *Pj* of 3D curve *Ci* and surface *Sj* of source edges *Ei*, *Fj*.
1a457208 219
220* Parameter *t<sub>i</sub>* of *Pi* for the 3D curve *Ci*.
221* Parameters *u<sub>i</sub>* and *v<sub>i</sub>* of the projected point *PPi* on the surface *Sj* of the face *Fj*.
222
223@subsubsection occt_algorithms_3_1_6 Face/Face Interference
224
225For a face *Fi* and a face *Fj* (with the corresponding surfaces *Si* and *Sj*) there are some places in 3D space, where the distance between the surfaces is less than (or equal to) sum of tolerances of the faces.
226
1a457208 227@figure{/user_guides/boolean_operations/images/operations_image009.svg, "Face/face interference: common curves"}
228
e9e33e91 229In the first case the result contains intersection curves *C<sub>ijk</sub> (k = 0, 1, 2…k<sub>N</sub>,* where *k<sub>N</sub>* is the number of intersection curves with corresponding values of tolerances *Tol(C<sub>ijk</sub>)*.
1a457208 230
231@figure{/user_guides/boolean_operations/images/operations_image010.svg, "Face/face interference: common points"}
232
e9e33e91 233In the second case Face *Fi* and face *Fj* have one or several new vertices *V<sub>ijm</sub>*, where <i>m=0,1,2, ... mN, mN </i> is the number of intersection points.
1a457208 234
e9e33e91 235The coordinates of a 3D point *P<sub>ijm</sub>* and the value *Tol(V<sub>ijm</sub>)* are computed as the center and the radius of the sphere enclosing the tolerance spheres of the corresponding nearest points *Pi*, *Pj* of the surface *Si*, *Sj* of source shapes *Fi*, *Fj*.
1a457208 236
e9e33e91 237* Parameters *u<sub>j</sub>*, *v<sub>j</sub>* belong to point *PPj* projected on surface *Sj* of face *Fj*.
238* Parameters *u<sub>i</sub>* and *v<sub>i</sub>* belong to point *PPi* projected on surface *Si* of face *Fi*.
1a457208 239
e9e33e91 240@subsubsection occt_algorithms_3_1_7 Vertex/Solid Interference
241
242For a vertex *Vi* and a solid *Zj* there is Vertex/Solid interference if the vertex *Vi* has no BRep interferences with any sub-shape of *Zj* and *Vi* is completely inside the solid *Zj*.
243
244@figure{/user_guides/boolean_operations/images/operations_image060.png, "Vertex/Solid Interference"}
245
246@subsubsection occt_algorithms_3_1_8 Edge/Soild Interference
247
248For an edge *Ei* and a solid *Zj* there is Edge/Solid interference if the edge *Ei* and its sub-shapes have no BRep interferences with any sub-shape of *Zj* and *Ei* is completely inside the solid *Zj*.
249
250@figure{/user_guides/boolean_operations/images/operations_image061.png, "Edge/Solid Interference"}
251
252@subsubsection occt_algorithms_3_1_9 Face/Soild Interference
253
254For a face *Fi* and a solid *Zj* there is Face/Solid interference if the face *Fi* and its sub-shapes have no BRep interferences with any sub-shape of *Zj* and *Fi* is completely inside the solid *Zj*.
255
256@figure{/user_guides/boolean_operations/images/operations_image062.png, "Face/Solid Interference"}
257
258@subsubsection occt_algorithms_3_1_10 Solid/Soild Interference
259
260For a solid *Zi* and a solid *Zj* there is Solid/Solid interference if the solid *Zi* and its sub-shapes have no BRep interferences with any sub-shape of *Zj* and *Zi* is completely inside the solid *Zj*.
261
262@figure{/user_guides/boolean_operations/images/operations_image063.png, "Solid/Solid Interference"}
263
264
265@subsubsection occt_algorithms_3_1_11 Computation Order
1a457208 266
267The interferences between shapes are computed on the basis of increasing of the dimension value of the shape in the following order:
268* Vertex/Vertex,
269* Vertex/Edge,
270* Edge/Edge,
271* Vertex/Face,
272* Edge/Face,
e9e33e91 273* Face/Face,
274* Vertex/Solid,
275* Edge/Solid,
276* Face/Solid,
277* Solid/Solid.
1a457208 278
279This order allows avoiding the computation of redundant interferences between upper-level shapes *Si* and *Sj* when there are interferences between lower sub-shapes *Sik* and *Sjm*.
280
e9e33e91 281@subsubsection occt_algorithms_3_1_12 Results
1a457208 282
283* The result of the interference is a shape that can be either interfered shape itself (or its part) or a new shape.
284* The result of the interference is a shape with the dimension value that is less or equal to the minimal dimension value of interfered shapes. For example, the result of Vertex/Edge interference is a vertex, but not an edge.
285* The result of the interference splits the source shapes on the parts each time as it can do that.
286
287@subsection occt_algorithms_3_2 Paves
288
289The result of interferences of the type Vertex/Edge, Edge/Edge and Edge/Face in most cases is a vertex (new or old) lying on an edge.
290
291The result of interferences of the type Face/Face in most cases is intersection curves, which go through some vertices lying on the faces.
292
293The position of vertex *Vi* on curve *C* can be defined by a value of parameter <i>t<sub>i</sub></i> of the 3D point of the vertex on the curve.
294Pave *PVi* on curve *C* is a structure containing the vertex *Vi* and correspondent value of the parameter <i>t<sub>i</sub></i> of the 3D point of the vertex on the curve. Curve *C* can be a 3D or a 2D curve.
295
296@figure{/user_guides/boolean_operations/images/operations_image011.svg, "Paves"}
297
298Two paves *PV1* and *PV2* on the same curve *C* can be compared using the parameter value @code PV1 > PV2 if t1 > t2 @endcode
299
300The usage of paves allows binding of the vertex to the curve (or any structure that contains a curve: edge, intersection curve).
301
302
303@subsection occt_algorithms_3_3 Pave Blocks
304
305A set of paves *PVi (i=1, 2...nPV)*, where *nPV* is the number of paves] of curve *C* can be sorted in the increasing order using the value of parameter *t* on curve *C*.
306
307A pave block *PBi* is a part of the object (edge, intersection curve) between neighboring paves.
308
309@figure{/user_guides/boolean_operations/images/operations_image012.svg, "Pave Blocks"}
310
311Any finite source edge *E* has at least one pave block that contains two paves *PVb* and *PVe*:
312* Pave *PVb* corresponds to the vertex *Vb* with minimal parameter <i>t<sub>b</sub></i> on the curve of the edge.
313* Pave *PVe* corresponds to the vertex *Ve* with maximal parameter <i>t<sub>e</sub></i> on the curve of the edge.
314
315@subsection occt_algorithms_3_4 Shrunk Range
316
e9e33e91 317Pave block *PV* of curve *C* is bounded by vertices *V1* and *V2* with tolerance values *Tol(V1)* and *Tol(V2)*. Curve *C* has its own tolerance value *Tol(C)*:
318* In case of edge, the tolerance value is the tolerance of the edge.
319* In case of intersection curve, the tolerance value is obtained from an intersection algorithm.
1a457208 320
321@figure{/user_guides/boolean_operations/images/operations_image013.svg, "Shrunk Range"}
322
323The theoretical parametric range of the pave block is <i>[t1C, t2C]</i>.
324
325The positions of the vertices *V1* and *V2* of the pave block can be different. The positions are determined by the following conditions:
326~~~~
e9e33e91 327Distance (P1, P1c) is equal or less than Tol(V1) + Tol(C)
328Distance (P2, P2c) is equal or less than Tol(V2) + Tol(C)
1a457208 329~~~~
330The Figure shows that each tolerance sphere of a vertex can reduce the parametric range of the pave block to a range <i>[t1S, t2S]</i>. The range <i>[t1S, t2S]</i> is the shrunk range of the pave block.
331
332The shrunk range of the pave block is the part of 3D curve that can interfere with other shapes.
333
334@subsection occt_algorithms_3_5 Common Blocks
335
336The interferences of the type Edge/Edge, Edge/Face produce results as common parts.
337
338In case of Edge/Edge interference the common parts are pave blocks that have different base edges.
339
340@figure{/user_guides/boolean_operations/images/operations_image014.svg, "Common Blocks: Edge/Edge interference"}
341
342If the pave blocks <i>PB<sub>1</sub>, PB<sub>2</sub>…PB<sub>NbPB</sub></i> , where *NbPB* is the number of pave blocks have the same bounding vertices and geometrically coincide, the pave blocks form common block *CB*.
343
344
345In case of Edge/Face interference the common parts are pave blocks lying on a face(s).
346
347@figure{/user_guides/boolean_operations/images/operations_image015.svg, "Common Blocks: Edge/Face interference"}
348
349If the pave blocks *PBi* geometrically coincide with a face *Fj*, the pave blocks form common block *CB*.
350
351In general case a common block *CB* contains:
352* Pave blocks *PBi (i=0,1,2, 3… NbPB)*.
3f812249 353* A set of faces *Fj (j=0,1... NbF), NbF* -- number of faces.
1a457208 354
355
356@subsection occt_algorithms_3_6 FaceInfo
357
358The structure *FaceInfo* contains the following information:
359* Pave blocks that have state **In** for the face;
360* Vertices that have state **In** for the face;
361* Pave blocks that have state **On** for the face;
362* Vertices that have state **On** for the face;
363* Pave blocks built up from intersection curves for the face;
364* Vertices built up from intersection points for the face.
365
366@figure{/user_guides/boolean_operations/images/operations_image016.svg, "Face Info"}
367
368In the figure, for face *F1*:
369* Pave blocks that have state **In** for the face: *PB<sub>in1</sub>*.
370* Vertices that have state **In** for the face: *V<sub>in1</sub>*.
371* Pave blocks that have state **On** for the face: *PB<sub>on11</sub>*, *PB<sub>on12</sub>*, *PB<sub>on2</sub>*, *PB<sub>on31</sub>*, *PB<sub>on32</sub>*, *PB<sub>on4</sub>*.
372* Vertices that have state **On** for the face: *V1, V2, V3, V4, V5, V6*.
373* Pave blocks built up from intersection curves for the face: *PB<sub>sc1</sub>*.
374* Vertices built up from intersection points for the face: none
375
376
377@section occt_algorithms_4 Data Structure
378
379Data Structure (DS) is used to:
380* Store information about input data and intermediate results;
381* Provide the access to the information;
382* Provide the links between the chunks of information.
383
384This information includes:
385* Arguments;
e9e33e91 386* Shapes;
1a457208 387* Interferences;
388* Pave Blocks;
389* Common Blocks.
390
391Data Structure is implemented in the class *BOPDS_DS*.
392
393@subsection occt_algorithms_4_1 Arguments
394
395The arguments are shapes (in terms of *TopoDS_Shape*):
396* Number of arguments is unlimited.
397* Each argument is a valid shape (in terms of *BRepCheck_Analyzer*).
398* Each argument can be of one of the following types (see the Table):
399
400| No | Type | Index of Type |
401| :----- | :----- | :----- |
402| 1 | COMPOUND | 0 |
403| 2 | COMPSOLID | 1 |
404| 3 | SOLID | 2 |
405| 4 | SHELL | 3 |
406| 5 | FACE | 4 |
407| 6 | WIRE | 5 |
408| 7 | EDGE | 6 |
409| 8 | VERTEX | 7 |
410
411* The argument of type *0 (COMPOUND)* can include any number of shapes of an arbitrary type (0, 1…7).
412* The argument should not be self-interfered, i.e. all sub-shapes of the argument that have geometrical coincidence through any topological entities (vertices, edges, faces) must share these entities.
413* There are no restrictions on the type of underlying geometry of the shapes. The faces or edges of arguments *S<sub>i</sub>* can have underlying geometry of any type supported by Open CASCADE Technology modeling algorithms (in terms of *GeomAbs_CurveType* and *GeomAbs_SurfaceType*).
e9e33e91 414* The faces or edges of the arguments should have underlying geometry with continuity that is not less than C1.
1a457208 415
416@subsection occt_algorithms_4_2 Shapes
e9e33e91 417
1a457208 418The information about Shapes is stored in structure *BOPDS_ShapeInfo*. The objects of type *BOPDS_ShapeInfo* are stored in the container of array type. The array allows getting the access to the information by an index (DS index).
419The structure *BOPDS_ShapeInfo* has the following contents:
420
421
422| Name | Contents |
423| :-------- | :----- |
424| *myShape* | Shape itself |
425| *myType* | Type of shape |
426| *myBox* | 3D bounding box of the shape |
427| *mySubShapes* | List of DS indices of sub-shapes |
428| *myReference* | Storage for some auxiliary information |
429| *myFlag* | Storage for some auxiliary information |
430
431@subsection occt_algorithms_4_3 Interferences
432
433The information about interferences is stored in the instances of classes that are inherited from class <i>BOPDS_Interf</i>.
434
435| Name | Contents |
436| :----- | :----- |
437| *BOPDS_Interf* | Root class for interference |
438| *Index1* | DS index of the shape 1 |
439| *Index2* | DS index of the shape 2 |
440| *BOPDS_InterfVV* | Storage for Vertex/Vertex interference |
441| *BOPDS_InterfVE* | Storage for Vertex/Edge interference |
442| *myParam* | The value of parameter of the point of the vertex on the curve of the edge |
443| *BOPDS_InterfVF* | Storage for Vertex/Face interference |
444| *myU, myV* | The value of parameters of the point of the vertex on the surface of the face |
445| *BOPDS_InterfEE* | Storage for Edge/Edge interference |
446| *myCommonPart* | Common part (in terms of *IntTools_CommonPart* ) |
447| *BOPDS_InterfEF* | Storage for Edge/Face interference |
e9e33e91 448| *myCommonPart* | Common part (in terms of *IntTools_CommonPart* ) |
1a457208 449| *BOPDS_InterfFF* | Storage for Face/Face interference |
450| *myTolR3D, myTolR2D* | The value of tolerances of curves (points) reached in 3D and 2D |
451| *myCurves* | Intersection Curves (in terms of *BOPDS_Curve*) |
452| *myPoints* | Intersection Points (in terms of *BOPDS_Point*) |
e9e33e91 453| *BOPDS_InterfVZ* | Storage for Vertex/Solid interference |
454| *BOPDS_InterfEZ* | Storage for Edge/Solid interference |
455| *BOPDS_InterfFZ* | Storage for Face/Solid interference |
456| *BOPDS_InterfZZ* | Storage for Solid/Solid interference |
457
458
459
1a457208 460
461
462The Figure shows inheritance diagram for *BOPDS_Interf* classes.
463
464@figure{/user_guides/boolean_operations/images/operations_image017.svg, "BOPDS_Interf classes"}
465
466
467@subsection occt_algorithms_4_4 Pave, PaveBlock and CommonBlock
468
469The information about the pave is stored in objects of type *BOPDS_Pave*.
470
471| Name | Contents |
472| :--- | :------ |
473| *BOPDS_Pave* | |
e9e33e91 474| *myIndex* | DS index of the vertex |
1a457208 475| *myParam* | Value of the parameter of the 3D point of vertex on curve. |
476
477The information about pave blocks is stored in objects of type *BOPDS_PaveBlock*.
478
479| Name | Contents |
480| :--- | :------ |
481| *BOPDS_PaveBlock* | |
482| *myEdge* | DS index of the edge produced from the pave block |
483| *myOriginalEdge* | DS index of the source edge |
484| *myPave1* | Pave 1 (in terms of *BOPDS_Pave*) |
485| *myPave2* | Pave 2 (in terms of *BOPDS_Pave*) |
486| *myExtPaves* | The list of paves (in terms of *BOPDS_Pave*) that is used to store paves lying inside the pave block during intersection process |
487| *myCommonBlock* | The reference to common block (in terms of *BOPDS_CommonBlock*) if the pave block is a common block |
488| *myShrunkData* | The shrunk range of the pave block |
489
490* To be bound to an edge (or intersection curve) the structures of type *BOPDS_PaveBlock* are stored in one container of list type <i>(BOPDS_ListOfPaveBlock)</i>.
491* In case of edge, all the lists of pave blocks above are stored in one container of array type. The array allows getting the access to the information by index of the list of pave blocks for the edge. This index (if exists) is stored in the field *myReference*.
492
493The information about common block is stored in objects of type *BOPDS_CommonBlock*.
494
495| Name | Contents |
496| :---- | :------ |
497| *BOPDS_CommonBlock* | |
498| *myPaveBlocks* | The list of pave blocks that are common in terms of @ref occt_algorithms_3_5 "Common Blocks" |
499| *myFaces* | The list of DS indices of the faces, on which the pave blocks lie. |
500
501
502@subsection occt_algorithms_4_5 Points and Curves
503The information about intersection point is stored in objects of type *BOPDS_Point*.
504
505| Name | Contents |
506| :---- | :----- |
507| *BOPDS_Point* | |
508| *myPnt* | 3D point |
509| *myPnt2D1* | 2D point on the face1 |
510| *myPnt2D2* | 2D point on the face2 |
511
512The information about intersection curve is stored in objects of type *BOPDS_Curve*.
513
514| Name | Contents |
515| :---- | :----- |
516| *BOPDS_Curve* | |
517| *myCurve* | The intersection curve (in terms of *IntTools_Curve* ) |
518| *myPaveBlocks* | The list of pave blocks that belong to the curve |
519| *myBox* | The bounding box of the curve (in terms of *Bnd_Box* ) |
520
521@subsection occt_algorithms_4_6 FaceInfo
522The information about *FaceInfo* is stored in a structure *BOPDS_FaceInfo*.
523The structure *BOPDS_FaceInfo* has the following contents.
524
525| Name | Contents |
526| :---- | :----- |
527| *BOPDS_FaceInfo* | |
528| *myPaveBlocksIn* | Pave blocks that have state In for the face |
529| *myVerticesIn* | Vertices that have state In for the face |
530| *myPaveBlocksOn* | Pave blocks that have state On for the face |
531| *myVerticesOn* | Vertices that have state On for the face |
532| *myPaveBlocksSc* | Pave blocks built up from intersection curves for the face |
533| *myVerticesSc* | Vertices built up from intersection points for the face +
534
535The objects of type *BOPDS_FaceInfo* are stored in one container of array type. The array allows getting the access to the information by index. This index (if exists) is stored in the field *myReference*.
536
537@section occt_algorithms_5 Intersection Part
538
539Intersection Part (IP) is used to
540* Initialize the Data Structure;
541* Compute interferences between the arguments (or their sub-shapes);
542* Compute same domain vertices, edges;
543* Build split edges;
544* Build section edges;
545* Build p-curves;
546* Store all obtained information in DS.
e9e33e91 547
548IP is implemented in the class *BOPAlgo_PaveFiller*.
549
550@figure{/user_guides/boolean_operations/images/operations_image064.svg, "Diagram for Class BOPAlgo_PaveFiller"}
551
552@subsection occt_algorithms_5_1a Class BOPAlgo_Algo
553The class *BOPAlgo_Algo* provides the base interface for all algorithms to provide the possibility to:
554* Get Error status;
555* Get Warning status;
556* Turn on/off the parallel processing
557* Break the operations by user request
558* Check data;
559* Check the result;
560* Set the appropriate memory allocator.
561
1a457208 562The description provided in the next paragraphs is coherent with the implementation of the method *BOPAlgo_PaveFiller::Perform()*.
563
564@subsection occt_algorithms_5_1 Initialization
565The input data for the step is the Arguments. The description of initialization step is shown in the Table.
566
567| No | Contents | Implementation |
568| :--- | :----- | :----- |
569| 1 | Initialization the array of shapes (in terms of @ref occt_algorithms_4_2 "Shapes"). Filling the array of shapes. | *BOPDS_DS::Init()* |
570| 2 | Initialization the array pave blocks (in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock, CommonBlock") | *BOPDS_DS::Init()* |
e9e33e91 571| 3 | Initialization of intersection Iterator. The intersection Iterator is the object that computes intersections between sub-shapes of the arguments in terms of bounding boxes. The intersection Iterator provides approximate number of the interferences for given type (in terms of @ref occt_algorithms_3_1 "Interferences") | *BOPDS_Iterator* |
572| 4 | Initialization of intersection Context. The intersection Context is an object that contains geometrical and topological toolkit (classifiers, projectors, etc). The intersection Context is used to cache the tools to increase the algorithm performance. | *IntTools_Context* |
1a457208 573
574
575@subsection occt_algorithms_5_2 Compute Vertex/Vertex Interferences
576
577The input data for this step is the DS after the @ref occt_algorithms_5_1 "Initialization". The description of this step is shown in the table :
578
579
580| No | Contents | Implementation |
581| :--- | :---- | :----- |
582| 1 | Initialize array of Vertex/Vertex interferences. | *BOPAlgo_PaveFiller::PerformVV()* |
583| 2 | Access to the pairs of interfered shapes <i>(nVi, nVj)k, k=0, 1…nk,</i> where *nVi* and *nVj* are DS indices of vertices *Vi* and *Vj* and *nk* is the number of pairs. | *BOPDS_Iterator* |
584| 3 | Compute the connexity chains of interfered vertices *nV1C, nV2C… nVnC)k, C=0, 1…nCs*, where *nCs* is the number of the connexity chains | *BOPAlgo_Tools::MakeBlocksCnx()* |
585| 4 | Build new vertices from the chains *VNc. C=0, 1…nCs.* | *BOPAlgo_PaveFiller::PerformVV()* |
586| 5 | Append new vertices in DS. | *BOPDS_DS::Append()* |
587| 6 | Append same domain vertices in DS. | *BOPDS_DS::AddShapeSD()* |
588| 7 | Append Vertex/Vertex interferences in DS. | *BOPDS_DS::AddInterf()* |
589
590* The pairs of interfered vertices are: <i>(nV11, nV12), (nV11, nV13), (nV12, nV13), (nV13, nV15), (nV13, nV14), (nV14, nV15), (nV21, nV22), (nV21, nV23), (nV22, nV23);</i>
591* These pairs produce two chains: <i>(nV11, nV12, nV13, nV14, nV15)</i> and <i>(nV21, nV22, nV23);</i>
592* Each chain is used to create a new vertex, *VN1* and *VN2*, correspondingly.
593
594The example of connexity chains of interfered vertices is given in the image:
595
596@figure{/user_guides/boolean_operations/images/operations_image018.svg, "Connexity chains of interfered vertices"}
597
598
599@subsection occt_algorithms_5_3 Compute Vertex/Edge Interferences
600
601The input data for this step is the DS after computing Vertex/Vertex interferences.
602
603| No | Contents | Implementation |
604| :--- | :--- | :--- |
605| 1 | Initialize array of Vertex/Edge interferences | *BOPAlgo_PaveFiller::PerformVE()* |
606| 2 | Access to the pairs of interfered shapes <i>(nVi, nEj)k k=0, 1…nk,</i> where *nVi* is DS index of vertex *Vi*, *nEj* is DS index of edge *Ej* and *nk* is the number of pairs. | *BOPDS_Iterator* |
607| 3 | Compute paves. See @ref occt_algorithms_3_1_2 "Vertex/Edge Interference" | *BOPInt_Context::ComputeVE()* |
608| 4 | Initialize pave blocks for the edges *Ej* involved in the interference | *BOPDS_DS:: ChangePaveBlocks()* |
609| 5 | Append the paves into the pave blocks in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock" | *BOPDS_PaveBlock:: AppendExtPave()* |
610| 6 | Append Vertex/Edge interferences in DS | *BOPDS_DS::AddInterf()* |
611
612@subsection occt_algorithms_5_4 Update Pave Blocks
613The input data for this step is the DS after computing Vertex/Edge Interferences.
614
615| No | Contents | Implementation |
616| :--- | :---- | :--- |
617| 1 | Each pave block PB containing internal paves is split by internal paves into new pave blocks *PBN1, PBN2… PBNn*. PB is replaced by new pave blocks *PBN1, PBN2… PBNn* in the DS. | *BOPDS_DS:: UpdatePaveBlocks()* |
618
619@subsection occt_algorithms_5_5 Compute Edge/Edge Interferences
620
621The input data for this step is the DS after updating Pave Blocks.
622
623| No | Contents | Implementation |
624| :---- | :---- | :----- |
625| 1 | Initialize array of Edge/Edge interferences | *BOPAlgo_PaveFiller::PerformEE()* |
626| 2 | Access to the pairs of interfered shapes <i>(nEi, nEj)k, k=0, 1…nk,</i> where *nEi* is DS index of the edge *Ei*, *nEj* is DS index of the edge *Ej* and *nk* is the number of pairs. | *BOPDS_Iterator* |
627| 3 | Initialize pave blocks for the edges involved in the interference, if it is necessary. | *BOPDS_DS:: ChangePaveBlocks()* |
628| 4 | Access to the pave blocks of interfered shapes: <i>(PBi1, PBi2…PBiNi)</i> for edge *Ei* and <i>(PBj1, PBj2…PBjNj)</i> for edge *Ej* | *BOPAlgo_PaveFiller::PerformEE()* |
629| 5 | Compute shrunk data for pave blocks in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock", if it is necessary. | *BOPAlgo_PaveFiller::FillShrunkData()* |
630| 6 | Compute Edge/Edge interference for pave blocks *PBix* and *PBiy*. The result of the computation is a set of objects of type *IntTools_CommonPart* | *IntTools_EdgeEdge* |
631| 7.1 | For each *CommonPart* of type *VERTEX:* Create new vertices *VNi (i =1, 2…,NbVN),* where *NbVN* is the number of new vertices. Intersect the vertices *VNi* using the steps Initialization and compute Vertex/Vertex interferences as follows: a) create a new object *PFn* of type *BOPAlgo_PaveFiller* with its own DS; b) use new vertices *VNi (i=1, 2…,NbVN), NbVN* as arguments (in terms of *TopoDs_Shape*) of *PFn*; c) invoke method *Perform()* for *PFn*. The resulting vertices *VNXi (i=1, 2…,NbVNX)*, where *NbVNX* is the number of vertices, are obtained via mapping between *VNi* and the results of *PVn*. | *BOPTools_Tools::MakeNewVertex()* |
632| 7.2 | For each *CommonPart* of type *EDGE:* Compute the coinciding connexity chains of pave blocks <i>(PB1C, PB2C… PNnC)k, C=0, 1…nCs,</i> where *nCs* is the number of the connexity chains. Create common blocks <i>(CBc. C=0, 1…nCs)</i> from the chains. Attach the common blocks to the pave blocks. | *BOPAlgo_Tools::PerformCommonBlocks()* |
633| 8 | Post-processing. Append the paves of *VNXi* into the corresponding pave blocks in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock" | *BOPDS_PaveBlock:: AppendExtPave()* |
634| 9 | Split common blocks CBc by the paves. | *BOPDS_DS:: UpdateCommonBlock()* |
635| 10 | Append Edge/Edge interferences in the DS. | *BOPDS_DS::AddInterf()* |
636
637The example of coinciding chains of pave blocks is given in the image:
638
639@figure{/user_guides/boolean_operations/images/operations_image019.png, "Coinciding chains of pave blocks"}
640
641* The pairs of coincided pave blocks are: <i>(PB11, PB12), (PB11, PB13), (PB12, PB13), (PB21, PB22), (PB21, PB23), (PB22, PB23).</i>
642* The pairs produce two chains: <i>(PB11, PB12, PB13)</i> and <i>(PB21, PB22, PB23).</i>
643
644@subsection occt_algorithms_5_6 Compute Vertex/Face Interferences
645
646The input data for this step is the DS after computing Edge/Edge interferences.
647
648| No | Contents | Implementation |
649| :---- | :--- | :---- |
650| 1 | Initialize array of Vertex/Face interferences | *BOPAlgo_PaveFiller::PerformVF()* |
651| 2 | Access to the pairs of interfered shapes <i>(nVi, nFj)k, k=0, 1…nk,</i> where *nVi* is DS index of the vertex *Vi*, *nFj* is DS index of the edge *Fj* and *nk* is the number of pairs. | *BOPDS_Iterator* |
652| 3 | Compute interference See @ref occt_algorithms_3_1_3 "Vertex/Face Interference" | *BOPInt_Context::ComputeVF()* |
e9e33e91 653| 4 | Append Vertex/Face interferences in the DS | *BOPDS_DS::AddInterf()* |
1a457208 654| 5 | Repeat steps 2-4 for each new vertex *VNXi (i=1, 2…,NbVNX),* where *NbVNX* is the number of vertices. | *BOPAlgo_PaveFiller::TreatVerticesEE()* |
655
656@subsection occt_algorithms_5_7 Compute Edge/Face Interferences
657The input data for this step is the DS after computing Vertex/Face Interferences.
658
659| No | Contents | Implementation |
660| :---- | :---- | :---- |
661| 1 | Initialize array of Edge/Face interferences | *BOPAlgo_PaveFiller::PerformEF()* |
662| 2 | Access to the pairs of interfered shapes <i>(nEi, nFj)k, k=0, 1…nk,</i> where *nEi* is DS index of edge *Ei*, *nFj* is DS index of face *Fj* and *nk* is the number of pairs. | *BOPDS_Iterator* |
663| 3 | Initialize pave blocks for the edges involved in the interference, if it is necessary. | *BOPDS_DS::ChangePaveBlocks()* |
664| 4 | Access to the pave blocks of interfered edge <i>(PBi1, PBi2…PBiNi)</i> for edge *Ei* | *BOPAlgo_PaveFiller::PerformEF()* |
665| 5 | Compute shrunk data for pave blocks (in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock") if it is necessary. | *BOPAlgo_PaveFiller::FillShrunkData()* |
666| 6 | Compute Edge/Face interference for pave block *PBix*, and face *nFj*. The result of the computation is a set of objects of type *IntTools_CommonPart* | *IntTools_EdgeFace* |
667| 7.1 | For each *CommonPart* of type *VERTEX:* Create new vertices *VNi (i=1, 2…,NbVN),* where *NbVN* is the number of new vertices. Merge vertices *VNi* as follows: a) create new object *PFn* of type *BOPAlgo_PaveFiller* with its own DS; b) use new vertices *VNi (i=1, 2…,NbVN), NbVN* as arguments (in terms of *TopoDs_Shape*) of *PFn*; c) invoke method *Perform()* for *PFn*. The resulting vertices *VNXi (i=1, 2…,NbVNX)*, where *NbVNX* is the number of vertices, are obtained via mapping between *VNi* and the results of *PVn*. | *BOPTools_Tools::MakeNewVertex()* and *BOPAlgo_PaveFiller::PerformVertices1()* |
668| 7.2 | For each *CommonPart* of type *EDGE:* Create common blocks <i>(CBc. C=0, 1…nCs)</i> from pave blocks that lie on the faces. Attach the common blocks to the pave blocks. | *BOPAlgo_Tools::PerformCommonBlocks()* |
669| 8 | Post-processing. Append the paves of *VNXi* into the corresponding pave blocks in terms of @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock". | *BOPDS_PaveBlock:: AppendExtPave()* |
670| 9 | Split pave blocks and common blocks *CBc* by the paves. | *BOPAlgo_PaveFiller::PerformVertices1()*, *BOPDS_DS:: UpdatePaveBlock()* and *BOPDS_DS:: UpdateCommonBlock()* |
671| 10 | Append Edge/Face interferences in the DS | *BOPDS_DS::AddInterf()* |
672| 11 | Update *FaceInfo* for all faces having EF common parts. | *BOPDS_DS:: UpdateFaceInfoIn()* |
673
674
675@subsection occt_algorithms_5_8 Build Split Edges
676
677The input data for this step is the DS after computing Edge/Face Interferences.
678
679For each pave block *PB* take the following steps:
680
681| No | Contents | Implementation |
682| :--- | :--- | :--- |
683| 1 | Get the real pave block *PBR*, which is equal to *PB* if *PB* is not a common block and to *PB<sub>1</sub>* if *PB* is a common block. *PB<sub>1</sub>* is the first pave block in the pave blocks list of the common block. See @ref occt_algorithms_4_4 "Pave, PaveBlock and CommonBlock". | *BOPAlgo_PaveFiller::MakeSplitEdges()* |
684| 2 | Build the split edge *Esp* using the information from *DS* and *PBR*. | *BOPTools_Tools::MakeSplitEdge()* |
685| 3 | Compute *BOPDS_ShapeInfo* contents for Esp | *BOPAlgo_PaveFiller::MakeSplitEdges()* |
686| 4 | Append *BOPDS_ShapeInfo* contents to the DS | *BOPDS_DS::Append()* |
687
688@subsection occt_algorithms_5_9 Compute Face/Face Interferences
689
690The input data for this step is DS after building Split Edges.
691
692| No | Contents | Implementation |
693| :--- | :--- | :--- |
e9e33e91 694| 1 | Initialize array of Face/Face interferences | *BOPAlgo_PaveFiller::PerformFF()* |
1a457208 695| 2 | Access to the pairs of interfered shapes <i>(nFi, nFj)k, k=0, 1…nk,</i> where *nFi* is DS index of edge *Fi*, *nFj* is DS index of face *Fj* and *nk* is the number of pairs. | *BOPDS_Iterator* |
696| 3 | Compute Face/Face interference | *IntTools_FaceFace* |
697| 4 | Append Face/Face interferences in the DS. | *BOPDS_DS::AddInterf()* |
698
699@subsection occt_algorithms_5_10 Build Section Edges
700
e9e33e91 701The input data for this step is the DS after computing Face/Face interferences.
1a457208 702
703| No | Contents | Implementation |
704| :---- | :---- | :---- |
3f812249 705| 1 | For each Face/Face interference *nFi, nFj*, retrieve @ref occt_algorithms_4_6 "FaceInfo". Create draft vertices from intersection points *VPk (k=1, 2…, NbVP)*, where *NbVP* is the number of new vertices, and the draft vertex *VPk* is created from an intersection point if *VPk ≠ Vm (m = 0, 1, 2… NbVm)*, where *Vm* is an existing vertex for the faces *nFi* and *nF,j* (*On* or *In* in terms of *TopoDs_Shape*), *NbVm* is the number of vertices existing on faces *nFi* and *nF,j* and ≠ -- means non-coincidence in terms of @ref occt_algorithms_3_1_1 "Vertex/Vertex interference". | *BOPAlgo_PaveFiller::MakeBlocks()* |
1a457208 706| 2 | For each intersection curve *Cijk* | |
707| 2.1 | Create paves PVc for the curve using existing vertices, i.e. vertices On or In (in terms of *FaceInfo*) for faces *nFi* and *nFj*. Append the paves *PVc* | *BOPAlgo_PaveFiller::PutPaveOnCurve()* and *BOPDS_PaveBlock::AppendExtPave()* |
708| 2.2 | Create technological vertices *Vt*, which are the bounding points of an intersection curve (with the value of tolerance *Tol(Cijk)*). Each vertex *Vt* with parameter *Tt* on curve *Cijk* forms pave *PVt* on curve *Cijk*. Append technological paves. | *BOPAlgo_PaveFiller::PutBoundPaveOnCurve()* |
709| 2.3 | Create pave blocks *PBk* for the curve using paves <i>(k=1, 2…, NbPB)</i>, where *NbPB* is the number of pave blocks | *BOPAlgo_PaveFiller::MakeBlocks()* |
3f812249 710| 2.4 | Build draft section edges *ESk* using the pave blocks <i>(k=1, 2…, NbES)</i>, where *NbES* is the number of draft section edges The draft section edge is created from a pave block *PBk* if *PBk* has state *In* or *On* for both faces *nFi* and *nF,j* and *PBk ≠ PBm (m=0, 1, 2… NbPBm)*, where *PBm* is an existing pave block for faces *nFi* and *nF,j* (*On* or *In* in terms of *FaceInfo*), *NbVm* is the number of existing pave blocks for faces *nFi* and *nF,j* and ≠ -- means non-coincidence (in terms of @ref occt_algorithms_3_1_3 "Vertex/Face interference"). | *BOPTools_Tools::MakeEdge()* |
1a457208 711| 3 | Intersect the draft vertices *VPk (k=1, 2…, NbVP)* and the draft section edges *ESk (k=1, 2…, NbES)*. For this: a) create new object *PFn* of type *BOPAlgo_PaveFiller* with its own DS; b) use vertices *VPk* and edges *ESk* as arguments (in terms of @ref occt_algorithms_4_1 "Arguments") of *PFn*; c) invoke method *Perform()* for *PFn*. Resulting vertices *VPXk (k=1, 2… NbVPX)* and edges *ESXk (k=1, 2… NbESX)* are obtained via mapping between *VPk, ESk* and the results of *PVn*. | *BOPAlgo_PaveFiller::PostTreatFF()* |
712| 4 | Update face info (sections about pave blocks and vertices) | *BOPAlgo_PaveFiller::PerformFF()* |
713
714@subsection occt_algorithms_5_11 Build P-Curves
715The input data for this step is the DS after building section edges.
716
717| No | Contents | Implementation |
718| :---- | :---- | :---- |
719| 1 | For each Face/Face interference *nFi* and *nFj* build p-Curves on *nFi* and *nFj* for each section edge *ESXk*. | *BOPAlgo_PaveFiller::MakePCurves()* |
720| 2 | For each pave block that is common for faces *nFi* and *nFj* build p-Curves on *nFi* and *nFj*. | *BOPAlgo_PaveFiller::MakePCurves()* |
721
722@subsection occt_algorithms_5_12 Process Degenerated Edges
723The input data for this step is the DS after building P-curves.
724
725| No | Contents | Implementation |
726| :---- | :---- | :---- |
727| | For each degenerated edge *ED* having vertex *VD* | BOPAlgo_PaveFiller::ProcessDE() |
728| 1 | Find pave blocks *PBi (i=1,2… NbPB)*, where *NbPB* is the number of pave blocks, that go through vertex *VD*. | *BOPAlgo_PaveFiller::FindPaveBlocks()* |
729| 2 | Compute paves for the degenerated edge *ED* using a 2D curve of *ED* and a 2D curve of *PBi*. Form pave blocks *PBDi (i=1,2… NbPBD)*, where *NbPBD* is the number of the pave blocks for the degenerated edge *ED* | *BOPAlgo_PaveFiller::FillPaves()* |
730| 3 | Build split edges *ESDi (i=1,2…NbESD)*, where *ESD* is the number of split edges, using the pave blocks *PBDi* | *BOPAlgo_PaveFiller:: MakeSplitEdge()* |
731
732@section occt_algorithms_6 General description of the Building Part
733
734Building Part (BP) is used to
735* Build the result of the operation
736* Provide history information (in terms of <i>\::Generated(), \::Modified()</i> and <i>\::IsDeleted()</i>)
737BP uses the DS prepared by *BOPAlgo_PaveFiller* described at chapter 5 as input data.
738BP is implemented in the following classes:
3f812249 739* *BOPAlgo_Builder* -- for the General Fuse operator (GFA).
740* *BOPAlgo_BOP* -- for the Boolean Operation operator (BOA).
741* *BOPAlgo_Section* -- for the Section operator (SA).
1a457208 742
743@figure{/user_guides/boolean_operations/images/operations_image020.svg, "Diagram for BP classes"}
744
1a457208 745The class *BOPAlgo_BuilderShape* provides the interface for algorithms that have:
746* A Shape as the result;
747* History information (in terms of <i>\::Generated(), \::Modified()</i> and <i>\::IsDeleted()).</i>
748
749@section occt_algorithms_7 General Fuse Algorithm
750@subsection occt_algorithms_7_1 Arguments
e9e33e91 751The arguments of the algorithm are shapes (in terms of *TopoDS_Shape*). The main requirements for the arguments are described in @ref occt_algorithms_4 "Data Structure" chapter.
1a457208 752
753@subsection occt_algorithms_7_2 Results
754
755During the operation argument *Si* can be split into several parts *Si1, Si2… Si1NbSp*, where *NbSp* is the number of parts. The set <i>(Si1, Si2… Si1NbSp)</i> is an image of argument *Si*.
e9e33e91 756* The result of the General Fuse operation is a compound. Each sub-shape of the compound corresponds to the certain argument shape S1, S2…Sn and has shared sub-shapes in accordance with interferences between the arguments.
1a457208 757* For the arguments of the type EDGE, FACE, SOLID the result contains split parts of the argument.
758* For the arguments of the type WIRE, SHELL, COMPSOLID, COMPOUND the result contains the image of the shape of the corresponding type (i.e. WIRE, SHELL, COMPSOLID or COMPOUND).
759The types of resulting shapes depend on the type of the corresponding argument participating in the operation. See the table below:
760
761| No | Type of argument | Type of resulting shape | Comments |
762| :--- | :---- | :--- | :--- |
763| 1 | COMPOUND | COMPOUND | The resulting COMPOUND is built from images of sub-shapes of type COMPOUND COMPSOLID, SHELL, WIRE and VERTEX. Sets of split sub-shapes of type SOLID, FACE, EDGE. |
764| 2 | COMPSOLID | COMPSOLID | The resulting COMPSOLID is built from split SOLIDs. |
765| 3 | SOLID | Set of split SOLIDs | |
766| 4 | SHELL | SHELL | The resulting SHELL is built from split FACEs |
767| 5 | FACE | Set of split FACEs | |
768| 6 | WIRE | WIRE | The resulting WIRE is built from split EDGEs |
769| 7 | EDGE | Set of split EDGEs | |
770| 8 | VERTEX | VERTEX | |
771
772@subsection occt_algorithms_7_3 Examples
773
e9e33e91 774Please, have a look at the examples, which can help to better understand the definitions.
1a457208 775
e9e33e91 776@subsubsection occt_algorithms_7_3_1 Case 1: Three edges intersecting at a point
1a457208 777
778Let us consider three edges: *E1, E2* and *E3* that intersect in one 3D point.
779
780@figure{/user_guides/boolean_operations/images/operations_image021.svg, "Three Intersecting Edges"}
781
782The result of the GFA operation is a compound containing 6 new edges: *E11, E12, E21, E22, E31*, and *E32*. These edges have one shared vertex *Vn1*.
783
784In this case:
785* The argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*).
786* The argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
787* The argument edge *E3* has resulting split edges *E31* and *E32* (image of *E3*).
788
e9e33e91 789@subsubsection occt_algorithms_7_3_2 Case 2: Two wires and an edge
1a457208 790
791Let us consider two wires *W1 (Ew11, Ew12, Ew13)* and *W2 (Ew21, Ew22, Ew23)* and edge *E1*.
792
793@figure{/user_guides/boolean_operations/images/operations_image022.svg, "Two wires and an edge"}
794
795The result of the GF operation is a compound consisting of 2 wires: *Wn1 (Ew11, En1, En2, En3, Ew13)* and *Wn2 (Ew21, En2, En3, En4, Ew23)* and two edges: *E11* and *E12*.
796
797In this case :
798* The argument *W1* has image *Wn1*.
799* The argument *W2* has image *Wn2*.
800* The argument edge *E1* has split edges *E11* and *E12*. (image of *E1*).
801The edges *En1, En2, En3, En4* and vertex *Vn1* are new shapes created during the operation. Edge *Ew12* has split edges *En1, En2* and *En3* and edge *Ew22* has split edges *En2, En3* and *En4*.
802
e9e33e91 803@subsubsection occt_algorithms_7_3_3 Case 3: An edge intersecting with a face
1a457208 804
805Let us consider edge *E1* and face *F2*:
806
807@figure{/user_guides/boolean_operations/images/operations_image023.svg, "An edge intersecting with a face"}
808
809The result of the GF operation is a compound consisting of 3 shapes:
810* Split edge parts *E11* and *E12* (image of *E1*).
811* New face *F21* with internal edge *E12* (image of *F2*).
812
e9e33e91 813@subsubsection occt_algorithms_7_3_4 Case 4: An edge lying on a face
1a457208 814
815Let us consider edge *E1* and face *F2*:
816
817@figure{/user_guides/boolean_operations/images/operations_image024.svg, "An edge lying on a face"}
818
819The result of the GF operation is a compound consisting of 5 shapes:
820* Split edge parts *E11, E12* and *E13* (image of *E1*).
821* Split face parts *F21* and *F22* (image of *F2*).
822
823
e9e33e91 824@subsubsection occt_algorithms_7_3_5 Case 5: An edge and a shell
1a457208 825
826Let us consider edge *E1* and shell *Sh2* that consists of 2 faces: *F21* and *F22*
827
828@figure{/user_guides/boolean_operations/images/operations_image025.svg, "An edge and a shell"}
829
830The result of the GF operation is a compound consisting of 5 shapes:
831* Split edge parts *E11, E12 , E13* and *E14* (image of *E1*).
832* Image shell *Sh21* (that contains split face parts *F211, F212, F221* and *F222*).
833
e9e33e91 834@subsubsection occt_algorithms_7_3_6 Case 6: A wire and a shell
1a457208 835
836Let us consider wire *W1 (E1, E2, E3, E4)* and shell *Sh2 (F21, F22)*.
837@figure{/user_guides/boolean_operations/images/operations_image026.svg, "A wire and a shell"}
838
839The result of the GF operation is a compound consisting of 2 shapes:
840
841* Image wire *W11* that consists of split edge parts from wire *W1: E11, E12, E13* and *E14*.
842* Image shell *Sh21* that contains split face parts: *F211, F212, F213, F221, F222* and *F223*.
843
e9e33e91 844@subsubsection occt_algorithms_7_3_7 Case 7: Three faces
1a457208 845
846Let us consider 3 faces: *F1, F2* and *F3*. @figure{/user_guides/boolean_operations/images/operations_image027.png, "Three faces"}
847
848The result of the GF operation is a compound consisting of 7 shapes:
849* Split face parts: *Fn1, Fn2, Fn3, Fn4, Fn5, Fn6* and *Fn7*.
850
e9e33e91 851@subsubsection occt_algorithms_7_3_8 Case 8: A face and a shell
1a457208 852
853Let us consider shell *Sh1 (F11, F12, F13)* and face *F2*.
854@figure{/user_guides/boolean_operations/images/operations_image028.png, "A face and a shell"}
855
856The result of the GF operation is a compound consisting of 4 shapes:
857* Image shell *Sh11* that consists of split face parts from shell *Sh1: Fn1, Fn2, Fn3, Fn4, Fn5* and *Fn6*.
858* Split parts of face *F2: Fn3, Fn6* and *Fn7*.
859
e9e33e91 860@subsubsection occt_algorithms_7_3_9 Case 9: A shell and a solid
1a457208 861
862Let us consider shell *Sh1 (F11, F12…F16)* and solid *So2*. @figure{/user_guides/boolean_operations/images/operations_image029.png, "A shell and a solid: arguments"}
863
864The result of the GF operation is a compound consisting of 2 shapes:
865* Image shell *Sh11* consisting of split face parts of *Sh1: Fn1, Fn2 ... Fn8.*
866* Solid *So21* with internal shell. (image of *So2*).
867@figure{/user_guides/boolean_operations/images/operations_image030.png, "A shell and a solid: results"}
868
e9e33e91 869@subsubsection occt_algorithms_7_3_10 Case 10: A compound and a solid
1a457208 870
871Let us consider compound *Cm1* consisting of 2 solids *So11* and *So12*) and solid *So2*.
872@figure{/user_guides/boolean_operations/images/operations_image031.png, "A compound and a solid: arguments"}
873
874The result of the GF operation is a compound consisting of 4 shapes:
875* Image compound *Cm11* consisting of split solid parts from *So11* and *So12 (Sn1, Sn2, Sn3, Sn4)*.
876* Split parts of solid *So2 (Sn2, Sn3, Sn5)*.
877
878@figure{/user_guides/boolean_operations/images/operations_image032.png, "A compound and a solid: results"}
879
880@subsection occt_algorithms_7_4 Class BOPAlgo_Builder
881
882GFA is implemented in the class *BOPAlgo_Builder*.
883
884@subsubsection occt_algorithms_7_4_1 Fields
885
886The main fields of the class are described in the Table:
887
888| Name | Contents |
889| :---- | :---- |
890| *myPaveFiller* | Pointer to the *BOPAlgo_PaveFiller* object |
891| *myDS* | Pointer to the *BOPDS_DS* object |
892| *myContext* | Pointer to the intersection Context |
893| *myImages* | The Map between the source shape and its images |
894| *myShapesSD* | The Map between the source shape (or split part of source shape) and the shape (or part of shape) that will be used in result due to same domain property. |
895
896@subsubsection occt_algorithms_7_4_2 Initialization
897
898The input data for this step is a *BOPAlgo_PaveFiller* object (in terms of @ref occt_algorithms_5 "Intersection") at the state after @ref occt_algorithms_5_12 "Processing of degenerated edges" with the corresponding DS.
899
900| No | Contents | Implementation |
901| :---- | :---- | :---- |
902| 1 | Check the readiness of the DS and *BOPAlgo_PaveFiller*. | *BOPAlgo_Builder::CheckData()* |
903| 2 | Build an empty result of type Compound. | *BOPAlgo_Builder::Prepare()* |
904
905@subsubsection occt_algorithms_7_4_3 Build Images for Vertices
906
907The input data for this step is *BOPAlgo_Builder* object after Initialisation.
908
909| No | Contents | Implementation |
910| :--- | :--- | :--- |
911| 1 | Fill *myShapesSD* by SD vertices using the information from the DS. | *BOPAlgo_Builder::FillImagesVertices()* |
912
913@subsubsection occt_algorithms_7_4_4 Build Result of Type Vertex
914
915The input data for this step is *BOPAlgo_Builder* object after building images for vertices and *Type*, which is the shape type (*TopAbs_VERTEX*).
916
917| No | Contents | Implementation |
918| :--- | :--- | :----- |
919| 1 | For the arguments of type *Type*. If there is an image for the argument: add the image to the result. If there is no image for the argument: add the argument to the result. | *BOPAlgo_Builder::BuildResult()* |
920
921@subsubsection occt_algorithms_7_4_5 Build Images for Edges
922
923The input data for this step is *BOPAlgo_Builder object* after building result of type vertex.
924
925| No | Contents | Implementation |
926| :---- | :---- | :----- |
927| 1 | For all pave blocks in the DS. Fill *myImages* for the original edge *E* by split edges *ESPi* from pave blocks. In case of common blocks on edges, use edge *ESPSDj* that corresponds to the leading pave block and fill *myShapesSD* by the pairs *ESPi/ESPSDj*. | *BOPAlgo_Builder::FillImagesEdges()* |
928
929@subsubsection occt_algorithms_7_4_6 Build Result of Type Edge
930
931This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex", but for the type *Edge*.
932
933@subsubsection occt_algorithms_7_4_7 Build Images for Wires
934
935The input data for this step is:
936* *BOPAlgo_Builder* object after building result of type *Edge*;
3f812249 937* Original Shape -- Wire
938* *Type* -- the shape type <i>(TopAbs_WIRE).</i>
1a457208 939
940| No | Contents | Implementation |
941| :---- | :---- | :----- |
942| 1 | For all arguments of the type *Type*. Create a container C of the type *Type*. | *BOPAlgo_Builder::FillImagesContainers()* |
943| 2 | Add to C the images or non-split parts of the *Original Shape*, taking into account its orientation. | *BOPAlgo_Builder::FillImagesContainers()* *BOPTools_Tools::IsSplitToReverse()* |
944| 3 | Fill *myImages* for the *Original Shape* by the information above. | *BOPAlgo_Builder::FillImagesContainers()* |
945
946@subsubsection occt_algorithms_7_4_8 Build Result of Type Wire
947
948This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex" but for the type *Wire*.
949
950@subsubsection occt_algorithms_7_4_9 Build Images for Faces
951
952The input data for this step is *BOPAlgo_Builder* object after building result of type *Wire*.
953
954| No | Contents | Implementation |
955| :--- | :--- | :--- |
956| 1 | Build Split Faces for all interfered DS shapes *Fi* of type *FACE*. | |
957| 1.1 | Collect all edges or their images of *Fi(ESPij)*. | *BOPAlgo_Builder::BuildSplitFaces()* |
958| 1.2 | Impart to ESPij the orientation to be coherent with the original one. | *BOPAlgo_Builder::BuildSplitFaces()* |
959| 1.3 | Collect all section edges *SEk* for *Fi*. | *BOPAlgo_Builder::BuildSplitFaces()* |
960| 1.4 | Build split faces for *Fi (Fi1, Fi2…FiNbSp)*, where *NbSp* is the number of split parts (see @ref occt_algorithms_7_2 "Building faces from a set of edges" for more details). | *BOPAlgo_BuilderFace* |
961| 1.5 | Impart to <i>(Fi1, Fi2…FiNbSp)</i> the orientation coherent with the original face *Fi*. | *BOPAlgo_Builder::BuildSplitFaces()* |
962| 1.6 | Fill the map mySplits with *Fi/(Fi1, Fi2…FiNbSp)* | *BOPAlgo_Builder::BuildSplitFaces()* |
963| 2 | Fill Same Domain faces | *BOPAlgo_Builder::FillSameDomainFaces* |
964| 2.1 | Find and collect in the contents of *mySplits* the pairs of same domain split faces <i>(Fij, Fkl)m</i>, where *m* is the number of pairs. | *BOPAlgo_Builder::FillSameDomainFaces* *BOPTools_Tools::AreFacesSameDomain()* |
965| 2.2 | Compute the connexity chains 1) of same domain faces <i>(F1C, F2C… FnC)k, C=0, 1…nCs,</i> where *nCs* is the number of connexity chains. | *BOPAlgo_Builder::FillSameDomainFaces()* |
966| 2.3 | Fill *myShapesSD* using the chains <i>(F1C, F2C… FnC)k</i> | *BOPAlgo_Builder::FillSameDomainFaces()* |
967| 2.4 | Add internal vertices to split faces. | *BOPAlgo_Builder::FillSameDomainFaces()* |
968| 2.5 | Fill *myImages* using *myShapesSD* and *mySplits*. | *BOPAlgo_Builder::FillSameDomainFaces()* |
969
970
971The example of chains of same domain faces is given in the image:
972
973@figure{/user_guides/boolean_operations/images/operations_image033.svg, "Chains of same domain faces"}
974
975* The pairs of same domain faces are: <i>(F11, F21), (F22, F31), (F41, F51) , (F41, F6)</i> and <i>(F51, F6)</i>.
976* The pairs produce the three chains: <i>(F11, F21), (F22, F31)</i> and <i>(F41, F51, F6)</i>.
977
978@subsubsection occt_algorithms_7_4_10 Build Result of Type Face
979This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex" but for the type *Face*.
980
981@subsubsection occt_algorithms_7_4_11 Build Images for Shells
982The input data for this step is:
983* *BOPAlgo_Builder* object after building result of type face;
3f812249 984* *Original Shape* -- a Shell;
985* *Type* -- the type of the shape <i>(TopAbs_SHELL)</i>.
1a457208 986
987The procedure is the same as for building images for wires.
988
989@subsubsection occt_algorithms_7_4_12 Build Result of Type Shell
990This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex" but for the type *Shell*.
991
992@subsubsection occt_algorithms_7_4_13 Build Images for Solids
993
994The input data for this step is *BOPAlgo_Builder* object after building result of type *Shell*.
995
996The following procedure is executed for all interfered DS shapes *Si* of type *SOLID*.
997
998| No | Contents | Implementation |
999| :--- | :--- | :--- |
1000| 1 | Collect all images or non-split parts for all faces <i>(FSPij)</i> that have 3D state *In Si*. | *BOPAlgo_Builder::FillIn3DParts ()* |
1001| 2 | Collect all images or non-split parts for all faces of *Si* | *BOPAlgo_Builder::BuildSplitSolids()* |
1002| 3 | Build split solids for *Si -> (Si1, Si2…SiNbSp)*, where *NbSp* is the number of split parts (see @ref occt_algorithms_7_2 "Building faces from a set of edges" for more details) | *BOPAlgo_BuilderSolid* |
1003| 4 | Fill the map Same Domain solids *myShapesSD* | *BOPAlgo_Builder::BuildSplitSolids()* |
1004| 5 | Fill the map *myImages* | *BOPAlgo_Builder::BuildSplitSolids()* |
1005| 6 | Add internal vertices to split solids | *BOPAlgo_Builder::FillInternalShapes()* |
1006
1007@subsubsection occt_algorithms_7_4_14 Build Result of Type Solid
1008This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex", but for the type Solid.
1009
1010@subsubsection occt_algorithms_7_4_15 Build Images for Type CompSolid
1011
1012The input data for this step is:
1013* *BOPAlgo_Builder* object after building result of type solid;
3f812249 1014* *Original Shape* -- a Compsolid;
1015* *Type* -- the type of the shape <i>(TopAbs_COMPSOLID)</i>.
1a457208 1016
1017The procedure is the same as for building images for wires.
1018
1019@subsubsection occt_algorithms_7_4_16 Build Result of Type Compsolid
1020This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex", but for the type Compsolid.
1021
1022@subsubsection occt_algorithms_7_4_17 Build Images for Compounds
1023The input data for this step is as follows:
3f812249 1024* *BOPAlgo_Builder* object after building results of type *compsolid*;
1025* *Original Shape* -- a Compound;
1026* *Type* -- the type of the shape <i>(TopAbs_COMPOUND)</i>.
1a457208 1027
1028The procedure is the same as for building images for wires.
1029
1030@subsubsection occt_algorithms_7_4_18 Build Result of Type Compound
1031
1032This step is the same as @ref occt_algorithms_7_4_4 "Building Result of Type Vertex", but for the type Compound.
1033
1034@subsubsection occt_algorithms_7_4_19 Post-Processing
1035The purpose of the step is to correct tolerances of the result to provide its validity in terms of *BRepCheck_Analyzer.*
1036
1037The input data for this step is a *BOPAlgo_Builder* object after building result of type compound.
1038
1039| No | Contents | Implementation |
1040| :---- | :---- | :----- |
1041| 1 | Correct tolerances of vertices on curves | *BOPTools_Tools::CorrectPointOnCurve()* |
1042| 2 | Correct tolerances of edges on faces | *BOPTools_Tools::CorrectCurveOnSurface()* |
1043
1044
1045@section occt_algorithms_9 Boolean Operations Algorithm
1046
1047@subsection occt_algorithms_9_1 Arguments
1048
e9e33e91 1049* The arguments of BOA are shapes in terms of *TopoDS_Shape*. The main requirements for the arguments are described in the @ref occt_algorithms_4 "Data Structure"
1050* There are two groups of arguments in BOA:
1051 * Objects <i>(S1=S11, S12, ...)</i>;
1052 * Tools <i>(S2=S21, S22, ...)</i>.
9526aa6a 1053* The following table contains the values of dimension for different types of arguments:
1a457208 1054
1055| No | Type of Argument | Index of Type | Dimension |
1056| :---- | :---- | :----- | :---- |
1057| 1 | COMPOUND | 0 | One of 0, 1, 2, 3 |
1058| 2 | COMPSOLID | 1 | 3 |
1059| 3 | SOLID | 2 | 3 |
1060| 4 | SHELL | 3 | 2 |
1061| 5 | FACE | 4 | 2 |
1062| 6 | WIRE | 5 | 1 |
1063| 7 | EDGE | 6 | 1 |
1064| 8 | VERTEX | 7 | 0 |
1065
9526aa6a 1066* For Boolean operation Fuse all arguments should have equal dimensions.
1067* For Boolean operation Cut the minimal dimension of *S2* should not be less than the maximal dimension of *S1*.
251a7984 1068* For Boolean operation Common the arguments can have any dimension.
1a457208 1069
e9e33e91 1070@subsection occt_algorithms_9_3 Results. General Rules
1a457208 1071
e9e33e91 1072* The result of the Boolean operation is a compound (if defined). Each sub-shape of the compound has shared sub-shapes in accordance with interferences between the arguments.
1a457208 1073* The content of the result depends on the type of the operation (Common, Fuse, Cut12, Cut21) and the dimensions of the arguments.
1074* The result of the operation Fuse is defined for arguments *S1* and *S2* that have the same dimension value : *Dim(S1)=Dim(S2)*. If the arguments have different dimension values the result of the operation Fuse is not defined. The dimension of the result is equal to the dimension of the arguments. For example, it is impossible to fuse an edge and a face.
1075* The result of the operation Fuse for arguments *S1* and *S2* contains the parts of arguments that have states **OUT** relative to the opposite arguments.
9526aa6a 1076* The result of the operation Fuse for arguments *S1* and *S2* having dimension value 3 (Solids) is refined by removing all possible internal faces to provide minimal number of solids.
251a7984 1077* The result of the operation Common for arguments *S1* and *S2* is defined for all values of the dimensions of the arguments. The result can contain shapes of different dimensions, but the minimal dimension of the result will be equal to the minimal dimension of the arguments. For example, the result of the operation Common between edges cannot be a vertex.
1a457208 1078* The result of the operation Common for the arguments *S1* and *S2* contains the parts of the argument that have states **IN** and **ON** relative to the opposite argument.
251a7984 1079* The result of the operation Cut is defined for arguments *S1* and *S2* that have values of dimensions *Dim(S2)* that should not be less than *Dim(S1)*. The result can contain shapes of different dimensions, but the minimal dimension of the result will be equal to the minimal dimension of the objects *Dim(S1)*. The result of the operation *Cut12* is not defined for other cases. For example, it is impossible to cut an edge from a solid, because a solid without an edge is not defined.
1a457208 1080* The result of the operation *Cut12* for arguments *S1* and *S2* contains the parts of argument *S1* that have state **OUT** relative to the opposite argument *S2*.
1081* The result of the operation *Cut21* for arguments *S1* and *S2* contains the parts of argument *S2* that have state **OUT** relative to the opposite argument *S1*.
251a7984 1082* For the arguments of collection type (WIRE, SHELL, COMPSOLID) the type will be passed in the result. For example, the result of Common operation between Shell and Wire will be a compound containing Wire.
1511c7e9 1083* For the arguments of collection type (WIRE, SHELL, COMPSOLID) containing overlapping parts the overlapping parts passed into result will be repeated for each container from the input shapes containing such parts.
1084* The result of the operation Fuse for the arguments of collection type (WIRE, SHELL, COMPSOLID) will contain the same number of containers as the arguments. The overlapping parts (EDGES/FACES/SOLIDS) will be shared among them. For example, the result of Fuse operation between two wires will be two wires sharing coinciding edges if any.
1085* The result of the operation Common for the arguments of collection type (WIRE, SHELL, COMPSOLID) will consist of the containers containing the same overlapping parts. For example, the result of Common operation between two fully/partially overlapping wires will be two wires containing the same edges.
1a457208 1086
1087@subsection occt_algorithms_9_4 Examples
1088
1089@subsubsection occt_algorithms_9_4_1 Case 1: Two Vertices
1090
1091Let us consider two interfering vertices *V1* and *V2*:
1092
1093@figure{/user_guides/boolean_operations/images/boolean_image001.svg}
1094
1095* The result of *Fuse* operation is the compound that contains new vertex *V*.
1096
1097@figure{/user_guides/boolean_operations/images/boolean_image002.svg}
1098
1099* The result of *Common* operation is a compound containing new vertex *V*.
1a457208 1100
1101* The result of *Cut12* operation is an empty compound.
1102* The result of *Cut21* operation is an empty compound.
1103
1104@subsubsection occt_algorithms_9_4_2 Case 2: A Vertex and an Edge
1105
1106Let us consider vertex *V1* and the edge *E2*, that intersect in a 3D point:
1107
1108@figure{/user_guides/boolean_operations/images/boolean_image004.png}
1109
1110* The result of *Fuse* operation is result is not defined because the dimension of the vertex (0) is not equal to the dimension of the edge (1).
1111
e9e33e91 1112* The result of *Common* operation is a compound containing vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with edge *E2*.
1a457208 1113
1114@figure{/user_guides/boolean_operations/images/boolean_image005.png}
1115
1116* The result of *Cut12* operation is an empty compound.
1117* The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the edge (1).
1118
1119@subsubsection occt_algorithms_9_4_3 Case 3: A Vertex and a Face
1120
1121Let us consider vertex *V1* and face *F2*, that intersect in a 3D point:
1122
1123@figure{/user_guides/boolean_operations/images/boolean_image006.png}
1124
1125* The result of *Fuse* operation is not defined because the dimension of the vertex (0) is not equal to the dimension of the face (2).
1126
e9e33e91 1127* The result of *Common* operation is a compound containing vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with face *F2*.
1a457208 1128
1129@figure{/user_guides/boolean_operations/images/boolean_image007.png}
1130
1131* The result of *Cut12* operation is an empty compound.
1132* The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the face (2).
1133
e9e33e91 1134@subsubsection occt_algorithms_9_4_4 Case 4: A Vertex and a Solid
1a457208 1135
1136Let us consider vertex *V1* and solid *S2*, that intersect in a 3D point:
1137
1138@figure{/user_guides/boolean_operations/images/boolean_image008.png}
1139
1140* The result of *Fuse* operation is not defined because the dimension of the vertex (0) is not equal to the dimension of the solid (3).
1141
e9e33e91 1142* The result of *Common* operation is a compound containing vertex *V<sub>1</sub>* as the argument *V<sub>1</sub>* has a common part with solid *S2*.
1a457208 1143
1144@figure{/user_guides/boolean_operations/images/boolean_image009.png}
1145
1146* The result of *Cut12* operation is an empty compound.
1147* The result of *Cut21* operation is not defined because the dimension of the vertex (0) is less than the dimension of the solid (3).
1148
1149@subsubsection occt_algorithms_9_4_5 Case 5: Two edges intersecting at one point
1150
e9e33e91 1151Let us consider edges *E1* and *E2* that intersect in a 3D point:
1a457208 1152
1153@figure{/user_guides/boolean_operations/images/boolean_image010.svg}
1154
1155* The result of *Fuse* operation is a compound containing split parts of arguments i.e. 4 new edges *E11, E12, E21*, and *E22*. These edges have one shared vertex *Vn1*.
1156In this case:
1157 * argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*);
1158 * argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
1159
1160@figure{/user_guides/boolean_operations/images/boolean_image011.svg}
1161
1162* The result of *Common* operation is an empty compound because the dimension (0) of the common part between the edges (vertex) is less than the dimension of the arguments (1).
1163
1164* The result of *Cut12* operation is a compound containing split parts of the argument *E1*, i.e. 2 new edges *E11* and *E12*. These edges have one shared vertex *Vn1*.
1165
e9e33e91 1166In this case the argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*).
1a457208 1167
1168@figure{/user_guides/boolean_operations/images/boolean_image012.svg}
1169
1170* The result of *Cut21* operation is a compound containing split parts of the argument *E2*, i.e. 2 new edges *E21* and *E12*. These edges have one shared vertex *Vn1*.
1171
1172In this case the argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*).
1173
1174@figure{/user_guides/boolean_operations/images/boolean_image013.svg}
1175
1176@subsubsection occt_algorithms_9_4_6 Case 6: Two edges having a common block
1177
e9e33e91 1178Let us consider edges *E1* and *E2* that have a common block:
1a457208 1179
1180@figure{/user_guides/boolean_operations/images/boolean_image014.svg}
1181
e9e33e91 1182* The result of *Fuse* operation is a compound containing split parts of arguments i.e. 3 new edges *E11*, *E12* and *E22*. These edges have two shared vertices.
1a457208 1183In this case:
1184 * argument edge *E1* has resulting split edges *E11* and *E12* (image of *E1*);
1185 * argument edge *E2* has resulting split edges *E21* and *E22* (image of *E2*);
1186 * edge *E12* is common for the images of *E1* and *E2*.
1187
1188@figure{/user_guides/boolean_operations/images/boolean_image015.svg}
1189
e9e33e91 1190* The result of *Common* operation is a compound containing split parts of arguments i.e. 1 new edge *E12*. In this case edge *E12* is common for the images of *E1* and *E2*.
1a457208 1191The common part between the edges (edge) has the same dimension (1) as the dimension of the arguments (1).
1192
1193@figure{/user_guides/boolean_operations/images/boolean_image016.svg}
1194
1195* The result of *Cut12* operation is a compound containing a split part of argument *E1*, i.e. new edge *E11*.
1196
1197@figure{/user_guides/boolean_operations/images/boolean_image017.svg}
1198
1199* The result of *Cut21* operation is a compound containing a split part of argument *E2*, i.e. new edge *E22*.
1200
1201@figure{/user_guides/boolean_operations/images/boolean_image018.svg}
1202
1203
1204@subsubsection occt_algorithms_9_4_7 Case 7: An Edge and a Face intersecting at a point
1205
e9e33e91 1206Let us consider edge *E1* and face *F2* that intersect at a 3D point:
1a457208 1207
1208@figure{/user_guides/boolean_operations/images/boolean_image019.png}
1209
1210* The result of *Fuse* operation is not defined because the dimension of the edge (1) is not equal to the dimension of the face (2).
1211
1212* The result of *Common* operation is an empty compound because the dimension (0) of the common part between the edge and face (vertex) is less than the dimension of the arguments (1).
1213
1214* The result of *Cut12* operation is a compound containing split parts of the argument *E1*, i.e. 2 new edges *E11* and *E12*.
1215
1216In this case the argument edge *E1* has no common parts with the face *F2* so the whole image of *E1* is in the result.
1217
1218@figure{/user_guides/boolean_operations/images/boolean_image020.png}
1219
1220* The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the face (2).
1221
1222@subsubsection occt_algorithms_9_4_8 Case 8: A Face and an Edge that have a common block
1223
e9e33e91 1224Let us consider edge *E1* and face *F2* that have a common block:
1a457208 1225
1226@figure{/user_guides/boolean_operations/images/boolean_image021.png}
1227
1228* The result of *Fuse* operation is not defined because the dimension of the edge (1) is not equal to the dimension of the face (2).
1229
1230* The result of *Common* operation is a compound containing a split part of the argument *E1*, i.e. new edge *E12*.
1231
1232In this case the argument edge *E1* has a common part with face *F2* so the corresponding part of the image of *E1* is in the result. The yellow square is not a part of the result. It only shows the place of *F2*.
1233
1234@figure{/user_guides/boolean_operations/images/boolean_image022.png}
1235
1236* The result of *Cut12* operation is a compound containing split part of the argument *E1*, i.e. new edge *E11*.
1237
1238In this case the argument edge *E1* has a common part with face *F2* so the corresponding part is not included into the result. The yellow square is not a part of the result. It only shows the place of F2.
1239
1240@figure{/user_guides/boolean_operations/images/boolean_image023.png}
1241
1242* The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the face (2).
1243
1244@subsubsection occt_algorithms_9_4_9 Case 9: An Edge and a Solid intersecting at a point
1245
e9e33e91 1246Let us consider edge *E1* and solid *S2* that intersect at a point:
1a457208 1247
1248@figure{/user_guides/boolean_operations/images/boolean_image024.png}
1249
1250* The result of *Fuse* operation is not defined because the dimension of the edge (1) is not equal to the dimension of the solid (3).
1251
1252* The result of *Common* operation is a compound containing a split part of the argument *E1*, i.e. new edge *E12*.
1253
1254In this case the argument edge *E1* has a common part with solid *S2* so the corresponding part of the image of *E1* is in the result. The yellow square is not a part of the result. It only shows the place of *S2*.
1255
1256@figure{/user_guides/boolean_operations/images/boolean_image025.png}
1257
1258* The result of *Cut12* operation is a compound containing split part of the argument *E1*, i.e. new edge *E11*.
1259
1260In this case the argument edge *E1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow square is not a part of the result. It only shows the place of *S2*.
1261
1262@figure{/user_guides/boolean_operations/images/boolean_image071.png}
1263
1264* The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the solid (3).
1265
e9e33e91 1266@subsubsection occt_algorithms_9_4_10 Case 10: An Edge and a Solid that have a common block
1a457208 1267
e9e33e91 1268Let us consider edge *E1* and solid *S2* that have a common block:
1a457208 1269
1270@figure{/user_guides/boolean_operations/images/boolean_image072.png}
1271
1272* The result of *Fuse* operation is not defined because the dimension of the edge (1) is not equal to the dimension of the solid (3).
1273
1274* The result of *Common* operation is a compound containing a split part of the argument *E1*, i.e. new edge *E12*.
1275
1276In this case the argument edge *E1* has a common part with solid *S2* so the corresponding part of the image of *E1* is in the result. The yellow square is not a part of the result. It only shows the place of *S2*.
1277
1278@figure{/user_guides/boolean_operations/images/boolean_image073.png}
1279
1280* The result of *Cut12* operation is a compound containing split part of the argument *E1*, i.e. new edge *E11*.
1281
e9e33e91 1282In this case the argument edge *E1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow square is not a part of the result. It only shows the place of *S2*.
1a457208 1283
1284@figure{/user_guides/boolean_operations/images/boolean_image026.png}
1285
1286* The result of *Cut21* operation is not defined because the dimension of the edge (1) is less than the dimension of the solid (3).
1287
1288@subsubsection occt_algorithms_9_4_11 Case 11: Two intersecting faces
1289
1290Let us consider two intersecting faces *F1* and *F2*:
1291
1292@figure{/user_guides/boolean_operations/images/boolean_image027.png}
1293
e9e33e91 1294* The result of *Fuse* operation is a compound containing split parts of arguments i.e. 2 new faces *F11* and *F21*. These faces have one shared edge *En1*.
1a457208 1295
1296@figure{/user_guides/boolean_operations/images/boolean_image028.png}
1297
1298
1299* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *F1* and *F2* (edge) is less than the dimension of arguments (2).
1300
1301* The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.
1302
1303@figure{/user_guides/boolean_operations/images/boolean_image029.png}
1304
1305* The result of *Cut21* operation is a compound containing split parts of the argument *F2*, i.e. 1 new face *F21*.
1306
1307@figure{/user_guides/boolean_operations/images/boolean_image030.png}
1308
1309@subsubsection occt_algorithms_9_4_12 Case 12: Two faces that have a common part
1310
e9e33e91 1311Let us consider two faces *F1* and *F2* that have a common part:
1a457208 1312
1313@figure{/user_guides/boolean_operations/images/boolean_image031.png}
1314
1315* The result of *Fuse* operation is a compound containing split parts of arguments, i.e. 3 new faces: *F11*, *F12* and *F22*. These faces are shared through edges In this case:
1316 * the argument edge *F1* has resulting split faces *F11* and *F12* (image of *F1*)
1317 * the argument face *F2* has resulting split faces *F12* and *F22* (image of *F2*)
1318 * the face *F12* is common for the images of *F1* and *F2*.
1319
1320@figure{/user_guides/boolean_operations/images/boolean_image032.png}
1321
1322* The result of *Common* operation is a compound containing split parts of arguments i.e. 1 new face *F12*.
1323In this case: face *F12* is common for the images of *F1* and *F2*.
1324The common part between the faces (face) has the same dimension (2) as the dimension of the arguments (2).
1325
1326
1327@figure{/user_guides/boolean_operations/images/boolean_image033.png}
1328
1329* The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.
1330
1331@figure{/user_guides/boolean_operations/images/boolean_image034.png}
1332
1333* The result of *Cut21* operation is a compound containing split parts of the argument *F2*, i.e. 1 new face *F21*.
1334
1335@figure{/user_guides/boolean_operations/images/boolean_image035.png}
1336
1337@subsubsection occt_algorithms_9_4_13 Case 13: Two faces that have a common edge
1338
1339Let us consider two faces *F1* and *F2* that have a common edge:
1340
1341@figure{/user_guides/boolean_operations/images/boolean_image036.png}
1342
1343* The result of *Fuse* operation is a compound containing split parts of arguments, i.e. 2 new faces: *F11* and *F21*. These faces have one shared edge *En1*.
1344
1345@figure{/user_guides/boolean_operations/images/boolean_image037.png}
1346
1347* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *F1* and *F2* (edge)is less than the dimension of the arguments (2)
1348
1349* The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*. The vertices are shown just to clarify the fact that the edges are spitted.
1350
1351@figure{/user_guides/boolean_operations/images/boolean_image038.png}
1352
1353* The result of *Cut21* operation is a compound containing split parts of the argument *F2*, i.e. 1 new face *F21*. The vertices are shown just to clarify the fact that the edges are spitted.
1354
1355@figure{/user_guides/boolean_operations/images/boolean_image039.png}
1356
1357@subsubsection occt_algorithms_9_4_14 Case 14: Two faces that have a common vertex
1358
1359Let us consider two faces *F1* and *F2* that have a common vertex:
1360
1361@figure{/user_guides/boolean_operations/images/boolean_image040.png}
1362
e9e33e91 1363* The result of *Fuse* operation is a compound containing split parts of arguments, i.e. 2 new faces: *F11* and *F21*. These faces have one shared vertex *Vn1*.
1a457208 1364
1365@figure{/user_guides/boolean_operations/images/boolean_image041.png}
1366
1367* The result of *Common* operation is an empty compound because the dimension (0) of the common part between *F1* and *F2* (vertex) is less than the dimension of the arguments (2)
1368
1369* The result of *Cut12* operation is a compound containing split part of the argument *F1*, i.e. new face *F11*.
1370
1371@figure{/user_guides/boolean_operations/images/boolean_image042.png}
1372
1373* The result of *Cut21* operation is a compound containing split parts of the argument *F2*, i.e. 1 new face *F21*.
1374
1375@figure{/user_guides/boolean_operations/images/boolean_image043.png}
1376
1377
1378@subsubsection occt_algorithms_9_4_15 Case 15: A Face and a Solid that have an intersection curve.
1379
1380Let us consider face *F1* and solid *S2* that have an intersection curve:
1381
1382@figure{/user_guides/boolean_operations/images/boolean_image044.png}
1383
1384* The result of *Fuse* operation is not defined because the dimension of the face (2) is not equal to the dimension of the solid (3).
1385
e9e33e91 1386* The result of *Common* operation is a compound containing split part of the argument *F1*. In this case the argument face *F1* has a common part with solid *S2*, so the corresponding part of the image of *F1* is in the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1a457208 1387
1388@figure{/user_guides/boolean_operations/images/boolean_image045.png}
1389
1390* The result of *Cut12* operation is a compound containing split part of the argument *F1*. In this case argument face *F1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1391
1392@figure{/user_guides/boolean_operations/images/boolean_image046.png}
1393
1394* The result of *Cut21* operation is is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1395
e9e33e91 1396@subsubsection occt_algorithms_9_4_16 Case 16: A Face and a Solid that have overlapping faces.
1a457208 1397
e9e33e91 1398Let us consider face *F1* and solid *S2* that have overlapping faces:
1a457208 1399
1400@figure{/user_guides/boolean_operations/images/boolean_image047.png}
1401
1402* The result of *Fuse* operation is not defined because the dimension of the face (2) is not equal to the dimension of the solid (3).
1403
e9e33e91 1404* The result of *Common* operation is a compound containing split part of the argument *F1*. In this case the argument face *F1* has a common part with solid *S2*, so the corresponding part of the image of *F1* is included in the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1a457208 1405
1406@figure{/user_guides/boolean_operations/images/boolean_image048.png}
1407
1408* The result of *Cut12* operation is a compound containing split part of the argument *F1*. In this case argument face *F1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1409
1410@figure{/user_guides/boolean_operations/images/boolean_image049.png}
1411
1412* The result of *Cut21* operation is is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1413
1414
e9e33e91 1415@subsubsection occt_algorithms_9_4_17 Case 17: A Face and a Solid that have overlapping edges.
1a457208 1416
e9e33e91 1417Let us consider face *F1* and solid *S2* that have overlapping edges:
1a457208 1418
1419@figure{/user_guides/boolean_operations/images/boolean_image050.png}
1420
1421* The result of *Fuse* operation is not defined because the dimension of the face (2) is not equal to the dimension of the solid (3).
1422
1423* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *F1* and *S2* (edge) is less than the lower dimension of the arguments (2).
1424
1425* The result of *Cut12* operation is a compound containing split part of the argument *F1*. In this case argument face *F1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1426
1427@figure{/user_guides/boolean_operations/images/boolean_image051.png}
1428
1429* The result of *Cut21* operation is is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1430
e9e33e91 1431@subsubsection occt_algorithms_9_4_18 Case 18: A Face and a Solid that have overlapping vertices.
1a457208 1432
e9e33e91 1433Let us consider face *F1* and solid *S2* that have overlapping vertices:
1a457208 1434
1435@figure{/user_guides/boolean_operations/images/boolean_image052.png}
1436
1437* The result of *Fuse* operation is not defined because the dimension of the face (2) is not equal to the dimension of the solid (3).
1438
1439* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *F1* and *S2* (vertex) is less than the lower dimension of the arguments (2).
1440
1441* The result of *Cut12* operation is a compound containing split part of the argument *F1*. In this case argument face *F1* has a common part with solid *S2* so the corresponding part is not included into the result. The yellow contour is not a part of the result. It only shows the place of *S2*.
1442
1443@figure{/user_guides/boolean_operations/images/boolean_image053.png}
1444
1445* The result of *Cut21* operation is is not defined because the dimension of the face (2) is less than the dimension of the solid (3).
1446
1447@subsubsection occt_algorithms_9_4_19 Case 19: Two intersecting Solids.
1448
1449Let us consider two intersecting solids *S1* and *S2*:
1450
1451@figure{/user_guides/boolean_operations/images/boolean_image054.png}
1452
e9e33e91 1453* The result of *Fuse* operation is a compound composed from the split parts of arguments *S11, S12* and *S22* <i>(Cut12, Common, Cut21)</i>. All inner webs are removed, so the result is one new solid *R*.
1a457208 1454
1455@figure{/user_guides/boolean_operations/images/boolean_image055.png}
1456
1457* The result of *Common* operation is a compound containing split parts of arguments i.e. one new solid *S12*. In this case solid *S12* is common for the images of *S1* and *S2*. The common part between the solids (solid) has the same dimension (3) as the dimension of the arguments (3). The yellow contour is not a part of the result. It only shows the place of *S1*.
1458
1459@figure{/user_guides/boolean_operations/images/boolean_image056.png}
1460
1461* The result of *Cut12* operation is a compound containing split part of the argument *S1*, i.e. 1 new solid *S11*.
1462
1463@figure{/user_guides/boolean_operations/images/boolean_image057.png}
1464
1465* The result of *Cut21* operation is a compound containing split part of the argument *S2*, i.e. 1 new solid *S21*.
1466
1467@figure{/user_guides/boolean_operations/images/boolean_image058.png}
1468
e9e33e91 1469@subsubsection occt_algorithms_9_4_20 Case 20: Two Solids that have overlapping faces.
1a457208 1470
1471Let us consider two solids *S1* and *S2* that have a common part on face:
1472
1473@figure{/user_guides/boolean_operations/images/boolean_image059.png}
1474
e9e33e91 1475* The result of *Fuse* operation is a compound composed from the split parts of arguments *S11, S12* and *S22* <i>(Cut12, Common, Cut21)</i>. All inner webs are removed, so the result is one new solid *R*.
1a457208 1476
1477@figure{/user_guides/boolean_operations/images/boolean_image060.png}
1478
1479* The result of *Common* operation is an empty compound because the dimension (2) of the common part between *S1* and *S2* (face) is less than the lower dimension of the arguments (3).
1480
1481* The result of *Cut12* operation is a compound containing split part of the argument *S1*, i.e. 1 new solid *S11*.
1482
1483@figure{/user_guides/boolean_operations/images/boolean_image061.png}
1484
1485* The result of *Cut21* operation is a compound containing split part of the argument *S2*, i.e. 1 new solid *S21*.
1486@figure{/user_guides/boolean_operations/images/boolean_image062.png}
1487
1488
e9e33e91 1489@subsubsection occt_algorithms_9_4_21 Case 21: Two Solids that have overlapping edges.
1a457208 1490
e9e33e91 1491Let us consider two solids *S1* and *S2* that have overlapping edges:
1a457208 1492
1493@figure{/user_guides/boolean_operations/images/boolean_image063.png}
1494
1495* The result of *Fuse* operation is a compound composed from the split parts of arguments i.e. 2 new solids *S11* and *S21*. These solids have one shared edge *En1*.
1496
1497@figure{/user_guides/boolean_operations/images/boolean_image064.png}
1498
1499* The result of *Common* operation is an empty compound because the dimension (1) of the common part between *S1* and *S2* (edge) is less than the lower dimension of the arguments (3).
1500
1501* The result of *Cut12* operation is a compound containing split part of the argument *S1*. In this case
1502argument *S1* has a common part with solid *S2* so the corresponding part is not included into the result.
1503
1504@figure{/user_guides/boolean_operations/images/boolean_image065.png}
1505
1511c7e9 1506* The result of *Cut21* operation is a compound containing split part of the argument *S2*. In this case
1a457208 1507argument *S2* has a common part with solid *S1* so the corresponding part is not included into the result.
1508@figure{/user_guides/boolean_operations/images/boolean_image066.png}
1509
e9e33e91 1510@subsubsection occt_algorithms_9_4_22 Case 22: Two Solids that have overlapping vertices.
1a457208 1511
e9e33e91 1512Let us consider two solids *S1* and *S2* that have overlapping vertices:
1a457208 1513
1514@figure{/user_guides/boolean_operations/images/boolean_image067.png}
1515
e9e33e91 1516* The result of *Fuse* operation is a compound composed from the split parts of arguments i.e. 2 new solids *S11* and *S21*. These solids share *Vn1*.
1a457208 1517
1518@figure{/user_guides/boolean_operations/images/boolean_image068.png}
1519
e9e33e91 1520* The result of *Common* operation is an empty compound because the dimension (0) of the common part between *S1* and *S2* (vertex) is less than the lower dimension of the arguments (3).
1a457208 1521
e9e33e91 1522* The result of *Cut12* operation is a compound containing split part of the argument *S1*.
1a457208 1523
1524@figure{/user_guides/boolean_operations/images/boolean_image069.png}
1525
e9e33e91 1526* The result of *Cut21* operation is a compound containing split part of the argument *S2*.
1a457208 1527
1528@figure{/user_guides/boolean_operations/images/boolean_image070.png}
1529
9526aa6a 1530@subsubsection occt_algorithms_9_4_23 Case 23: A Shell and a Wire cut by a Solid.
1531
1532Let us consider Shell *Sh* and Wire *W* as the objects and Solid *S* as the tool:
1533
1534@figure{/user_guides/boolean_operations/images/boolean_image136.png}
1535
1536* The result of *Fuse* operation is not defined as the dimension of the arguments is not the same.
1537
1538* The result of *Common* operation is a compound containing the parts of the initial Shell and Wire common for the Solid. The new Shell and Wire are created from the objects.
1539
1540@figure{/user_guides/boolean_operations/images/boolean_image137.png}
1541
1511c7e9 1542* The result of *Cut12* operation is a compound containing new Shell and Wire split from the arguments *Sh* and *W*. In this case they have a common part with solid *S* so the corresponding part is not included into the result.
9526aa6a 1543
1544@figure{/user_guides/boolean_operations/images/boolean_image138.png}
1545
251a7984 1546* The result of *Cut21* operation is not defined as the objects have a lower dimension than the tool.
9526aa6a 1547
1511c7e9 1548@subsubsection occt_algorithms_9_4_24 Case 24: Two Wires that have overlapping edges.
1549
1550Let us consider two Wires that have overlapping edges, *W1* is the object and *W2* is the tool:
1551
1552@figure{/user_guides/boolean_operations/images/boolean_image139.png}
1553
1554* The result of *Fuse* operation is a compound containing two Wires, which share an overlapping edge. The new Wires are created from the objects:
1555
1556@figure{/user_guides/boolean_operations/images/boolean_image140.png}
1557
1558* The result of *Common* operation is a compound containing two Wires both consisting of an overlapping edge. The new Wires are created from the objects:
1559
1560@figure{/user_guides/boolean_operations/images/boolean_image141.png}
1561
1562* The result of *Cut12* operation is a compound containing a wire split from object *W1*. Its common part with *W2* is not included into the result.
1563
1564@figure{/user_guides/boolean_operations/images/boolean_image142.png}
1565
1566* The result of *Cut21* operation is a compound containing a wire split from *W2*. Its common part with *W1* is not included into the result.
1567
1568@figure{/user_guides/boolean_operations/images/boolean_image143.png}
1569
1a457208 1570
1571@subsection occt_algorithms_9_5 Class BOPAlgo_BOP
1572
1573BOA is implemented in the class *BOPAlgo_BOP*. The main fields of this class are described in the Table:
1574
1575| Name | Contents |
1576| :---- | :--- |
1577| *myOperation* | The type of the Boolean operation (Common, Fuse, Cut) |
e9e33e91 1578| *myTools* | The tools |
1a457208 1579| *myDims[2]* | The values of the dimensions of the arguments |
1580| *myRC* | The draft result (shape) |
1581
1582The main steps of the *BOPAlgo_BOP* are the same as of @ref occt_algorithms_7_4 "BOPAlgo_Builder" except for some aspects described in the next paragraphs.
1583
1584@subsection occt_algorithms_9_6 Building Draft Result
1585
1586The input data for this step is as follows:
1587* *BOPAlgo_BOP* object after building result of type *Compound*;
1588* *Type* of the Boolean operation.
1589
1590| No | Contents | Implementation |
1591| :---- | :----- | :----- |
1592| 1 | For the Boolean operation *Fuse* add to *myRC* all images of arguments. | *BOPAlgo_BOP::BuildRC()* |
e9e33e91 1593| 2 | For the Boolean operation *Common* or *Cut* add to *myRC* all images of argument *S1* that are *Common* for the Common operation and are *Not Common* for the Cut operation | *BOPAlgo_BOP::BuildRC()* |
1a457208 1594
1595@subsection occt_algorithms_9_7 Building the Result
1596
1597The input data for this step is as follows:
1598* *BOPAlgo_BOP* object the state after building draft result.
1599
1600| No | Contents | Implementation |
1601| :---- | :---- | :------ |
9526aa6a 1602| 1 | For the Type of the Boolean operation Common, Cut with any dimension and operation Fuse with *myDim[0] < 3* | |
1603| 1.1 | Find containers (WIRE, SHELL, COMPSOLID) in the arguments | *BOPAlgo_BOP:: BuildShape()* |
1604| 1.2 | Make connexity blocks from splits of each container that are in *myRC* | *BOPTools_Tools::MakeConnexityBlocks()* |
1a457208 1605| 1.3 | Build the result from shapes made from the connexity blocks | *BOPAlgo_BOP:: BuildShape()* |
9526aa6a 1606| 1.4 | Add the remaining shapes from *myRC* to the result | *BOPAlgo_BOP:: BuildShape()* |
1607| 2 | For the Type of the Boolean operation Fuse with *myDim[0] = 3* | |
1608| 2.1 | Find internal faces <i>(FWi)</i> in *myRC* | *BOPAlgo_BOP::BuildSolid()* |
1609| 2.2 | Collect all faces of *myRC* except for internal faces <i>(FWi) -> SFS</i> | *BOPAlgo_BOP::BuildSolid ()* |
1610| 2.3 | Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
1611| 2.4 | Add the solids <i>(SDi)</i> to the result | |
1a457208 1612
e9e33e91 1613@section occt_algorithms_10a Section Algorithm
1614
1615@subsection occt_algorithms_10a_1 Arguments
1616
1617The arguments of BOA are shapes in terms of *TopoDS_Shape*. The main requirements for the arguments are described in the Algorithms.
1618
1619@subsection occt_algorithms_10a_2 Results and general rules
1620* The result of Section operation is a compound. Each sub-shape of the compound has shared sub-shapes in accordance with interferences between the arguments.
1621* The result of Section operation contains shapes that have dimension that is less then 2 i.e. vertices and edges.
1622* The result of Section operation contains standalone vertices if these vertices do not belong to the edges of the result.
1623* The result of Section operation contains vertices and edges of the arguments (or images of the arguments) that belong to at least two arguments (or two images of the arguments).
1624* The result of Section operation contains Section vertices and edges obtained from Face/Face interferences.
1625* The result of Section operation contains vertices that are the result of interferences between vertices and faces.
1626* The result of Section operation contains edges that are the result of interferences between edges and faces (Common Blocks),
1627
1628@subsection occt_algorithms_10a_3 Examples
1629
1630@subsubsection occt_algorithms_10a_3_1 Case 1: Two Vertices
1631
1632Let us consider two interfering vertices: *V1* and *V2*.
1633
1634@figure{/user_guides/boolean_operations/images/boolean_image080.png}
1635
1636The result of *Section* operation is the compound that contains a new vertex *V*.
1637
1638@figure{/user_guides/boolean_operations/images/boolean_image081.png}
1639
1640@subsubsection occt_algorithms_10a_3_2 Case 1: Case 2: A Vertex and an Edge
1641
1642Let us consider vertex *V1* and the edge *E2*, that intersect in a 3D point:
1643
1644@figure{/user_guides/boolean_operations/images/boolean_image082.png}
1645
1646The result of *Section* operation is the compound that contains vertex *V1*.
1647
1648@figure{/user_guides/boolean_operations/images/boolean_image083.png}
1649
1650@subsubsection occt_algorithms_10a_3_3 Case 1: Case 2: A Vertex and a Face
1651
1652Let us consider vertex *V1* and face *F2*, that intersect in a 3D point:
1653
1654@figure{/user_guides/boolean_operations/images/boolean_image084.png}
1655
1656The result of *Section* operation is the compound that contains vertex *V1*.
1657
1658@figure{/user_guides/boolean_operations/images/boolean_image085.png}
1659
1660@subsubsection occt_algorithms_10a_3_4 Case 4: A Vertex and a Solid
1661
1662Let us consider vertex *V1* and solid *Z2*. The vertex *V1* is inside the solid *Z2*.
1663
1664@figure{/user_guides/boolean_operations/images/boolean_image086.png}
1665
1666The result of *Section* operation is an empty compound.
1667
1668@subsubsection occt_algorithms_10a_3_5 Case 5: Two edges intersecting at one point
1669
1670Let us consider edges *E1* and *E2*, that intersect in a 3D point:
1671
1672@figure{/user_guides/boolean_operations/images/boolean_image087.png}
1673
1674The result of *Section* operation is the compound that contains a new vertex *Vnew*.
1675
1676@figure{/user_guides/boolean_operations/images/boolean_image088.png}
1677
1678@subsubsection occt_algorithms_10a_3_6 Case 6: Two edges having a common block
1679
1680Let us consider edges *E1* and *E2*, that have a common block:
1681
1682@figure{/user_guides/boolean_operations/images/boolean_image089.png}
1683
1684The result of *Section* operation is the compound that contains a new edge *Enew*.
1685
1686@figure{/user_guides/boolean_operations/images/boolean_image090.png}
1687
1688@subsubsection occt_algorithms_10a_3_7 Case 7: An Edge and a Face intersecting at a point
1689
1690Let us consider edge *E1* and face *F2*, that intersect at a 3D point:
1691
1692@figure{/user_guides/boolean_operations/images/boolean_image091.png}
1693
1694The result of *Section* operation is the compound that contains a new vertex *Vnew*.
1695
1696@figure{/user_guides/boolean_operations/images/boolean_image092.png}
1697
1698@subsubsection occt_algorithms_10a_3_8 Case 8: A Face and an Edge that have a common block
1699
1700Let us consider edge *E1* and face *F2*, that have a common block:
1701
1702@figure{/user_guides/boolean_operations/images/boolean_image093.png}
1703
1704The result of *Section* operation is the compound that contains new edge *Enew*.
1705
1706@figure{/user_guides/boolean_operations/images/boolean_image094.png}
1707
1708
1709@subsubsection occt_algorithms_10a_3_9 Case 9: An Edge and a Solid intersecting at a point
1710
1711Let us consider edge *E1* and solid *Z2*, that intersect at a point:
1712
1713@figure{/user_guides/boolean_operations/images/boolean_image095.png}
1714
1715The result of *Section* operation is the compound that contains a new vertex *Vnew*.
1716
1717@figure{/user_guides/boolean_operations/images/boolean_image096.png}
1718
1719@subsubsection occt_algorithms_10a_3_10 Case 10: An Edge and a Solid that have a common block
1720
1721Let us consider edge *E1* and solid *Z2*, that have a common block at a face:
1722
1723@figure{/user_guides/boolean_operations/images/boolean_image097.png}
1724
1725The result of *Section* operation is the compound that contains a new edge *Enew*.
1726
1727@figure{/user_guides/boolean_operations/images/boolean_image098.png}
1728
1729@subsubsection occt_algorithms_10a_3_11 Case 11: Two intersecting faces
1730
1731Let us consider two intersecting faces *F1* and *F2*:
1732
1733@figure{/user_guides/boolean_operations/images/boolean_image099.png}
1734
1735The result of *Section* operation is the compound that contains a new edge *Enew*.
1736
1737@figure{/user_guides/boolean_operations/images/boolean_image100.png}
1738
1739@subsubsection occt_algorithms_10a_3_12 Case 12: Two faces that have a common part
1740
1741Let us consider two faces *F1* and *F2* that have a common part:
1742
1743@figure{/user_guides/boolean_operations/images/boolean_image133.png}
1744
1745The result of *Section* operation is the compound that contains 4 new edges.
1746
1747@figure{/user_guides/boolean_operations/images/boolean_image134.png}
1748
1749@subsubsection occt_algorithms_10a_3_13 Case 13: Two faces that have overlapping edges
1750
1751Let us consider two faces *F1* and *F2* that have a overlapping edges:
1752
1753@figure{/user_guides/boolean_operations/images/boolean_image101.png}
1754
1755The result of *Section* operation is the compound that contains a new edge *Enew*.
1756
1757@figure{/user_guides/boolean_operations/images/boolean_image102.png}
1758
1759@subsubsection occt_algorithms_10a_3_14 Case 14: Two faces that have overlapping vertices
1760
1761Let us consider two faces *F1* and *F2* that have overlapping vertices:
1762
1763@figure{/user_guides/boolean_operations/images/boolean_image103.png}
1764
1765The result of *Section* operation is the compound that contains a new vertex *Vnew*.
1766
1767@figure{/user_guides/boolean_operations/images/boolean_image104.png}
1768
1769@subsubsection occt_algorithms_10a_3_15 Case 15: A Face and a Solid that have an intersection curve
1770
1771Let us consider face *F1* and solid *Z2* that have an intersection curve:
1772
1773@figure{/user_guides/boolean_operations/images/boolean_image105.png}
1774
1775The result of *Section* operation is the compound that contains new edges.
1776
1777@figure{/user_guides/boolean_operations/images/boolean_image106.png}
1778
1779@subsubsection occt_algorithms_10a_3_16 Case 16: A Face and a Solid that have overlapping faces.
1780
1781Let us consider face *F1* and solid *Z2* that have overlapping faces:
1782
1783@figure{/user_guides/boolean_operations/images/boolean_image107.png}
1784
1785The result of *Section* operation is the compound that contains new edges
1786
1787@figure{/user_guides/boolean_operations/images/boolean_image108.png}
1788
1789@subsubsection occt_algorithms_10a_3_17 Case 17: A Face and a Solid that have overlapping edges.
1790
1791Let us consider face *F1* and solid *Z2* that have a common part on edge:
1792
1793@figure{/user_guides/boolean_operations/images/boolean_image109.png}
1794
1795The result of *Section* operation is the compound that contains a new edge *Enew*.
1796
1797@figure{/user_guides/boolean_operations/images/boolean_image110.png}
1798
1799@subsubsection occt_algorithms_10a_3_18 Case 18: A Face and a Solid that have overlapping vertices.
1800
1801Let us consider face *F1* and solid *Z2* that have overlapping vertices:
1802
1803@figure{/user_guides/boolean_operations/images/boolean_image111.png}
1804
1805The result of *Section* operation is the compound that contains a new vertex *Vnew*.
1806
1807@figure{/user_guides/boolean_operations/images/boolean_image112.png}
1808
1809@subsubsection occt_algorithms_10a_3_19 Case 19: Two intersecting Solids
1810
1811Let us consider two intersecting solids *Z1* and *Z2*:
1812@figure{/user_guides/boolean_operations/images/boolean_image113.png}
1813
1814The result of *Section* operation is the compound that contains new edges.
1815@figure{/user_guides/boolean_operations/images/boolean_image114.png}
1816
1817@subsubsection occt_algorithms_10a_3_20 Case 20: Two Solids that have overlapping faces
1818
1819Let us consider two solids *Z1* and *Z2* that have a common part on face:
1820@figure{/user_guides/boolean_operations/images/boolean_image115.png}
1821
1822The result of *Section* operation is the compound that contains new edges.
1823@figure{/user_guides/boolean_operations/images/boolean_image116.png}
1824
1825@subsubsection occt_algorithms_10a_3_21 Case 21: Two Solids that have overlapping edges
1826
1827Let us consider two solids *Z1* and *Z2* that have overlapping edges:
1828@figure{/user_guides/boolean_operations/images/boolean_image117.png}
1829
1830The result of *Section* operation is the compound that contains a new edge *Enew*.
1831@figure{/user_guides/boolean_operations/images/boolean_image118.png}
1832
1833@subsubsection occt_algorithms_10a_3_22 Case 22: Two Solids that have overlapping vertices
1834
1835Let us consider two solids *Z1* and *Z2* that have overlapping vertices:
1836@figure{/user_guides/boolean_operations/images/boolean_image119.png}
1837
1838The result of *Section* operation is the compound that contains a new vertex *Vnew*.
1839@figure{/user_guides/boolean_operations/images/boolean_image120.png}
1840
1841@subsection occt_algorithms_10a_4 Class BOPAlgo_Section
1842
1843SA is implemented in the class *BOPAlgo_Section*. The class has no specific fields.
1844The main steps of the *BOPAlgo_Section* are the same as of *BOPAlgo_Builder* except for the following steps:
1845
1846* Build Images for Wires;
1847* Build Result of Type Wire;
1848* Build Images for Faces;
1849* Build Result of Type Face;
1850* Build Images for Shells;
1851* Build Result of Type Shell;
1852* Build Images for Solids;
1853* Build Result of Type Solid;
1854* Build Images for Type CompSolid;
1855* Build Result of Type CompSolid;
1856* Build Images for Compounds;
1857Some aspects of building the result are described in the next paragraph
1858
1859@subsection occt_algorithms_10a_5 Building the Result
1860
1861| No | Contents | Implementation |
1862| :---- | :---- | :------ |
1863| 1 | Build the result of the operation using all information contained in *FaceInfo*, Common Block, Shared entities of the arguments, etc. | *BOPAlgo_Section:: BuildSection()* |
1864
1865
1866
1a457208 1867@section occt_algorithms_10 Algorithm Limitations
1868
1869The chapter describes the problems that are considered as Algorithm limitations. In most cases an Algorithm failure is caused by a combination of various factors, such as self-interfered arguments, inappropriate or ungrounded values of the argument tolerances, adverse mutual position of the arguments, tangency, etc.
1870
e9e33e91 1871A lot of failures of GFA algorithm can be caused by bugs in low-level algorithms: Intersection Algorithm, Projection Algorithm, Approximation Algorithm, Classification Algorithm, etc.
1a457208 1872* The Intersection, Projection and Approximation Algorithms are mostly used at the Intersection step. Their bugs directly cause wrong section results (i.e. incorrect section edges, section points, missing section edges or micro edges). It is not possible to obtain a correct final result of the GFA if a section result is wrong.
3f812249 1873* The Projection Algorithm is used at the Intersection step. The purpose of Projection Algorithm is to compute 2D curves on surfaces. Wrong results here lead to incorrect or missing faces in the final GFA result.
1a457208 1874* The Classification Algorithm is used at the Building step. The bugs in the Classification Algorithm lead to errors in selecting shape parts (edges, faces, solids) and ultimately to a wrong final GFA result.
1875
1876The description below illustrates some known GFA limitations. It does not enumerate exhaustively all problems that can arise in practice. Please, address cases of Algorithm failure to the OCCT Maintenance Service.
1877
1878
1879@subsection occt_algorithms_10_1 Arguments
1880
1881@subsubsection occt_algorithms_10_1_1 Common requirements
1882
1883Each argument should be valid (in terms of *BRepCheck_Analyzer*), or conversely, if the argument is considered as non-valid (in terms of *BRepCheck_Analyzer*), it cannot be used as an argument of the algorithm.
1884
1885The class *BRepCheck_Analyzer* is used to check the overall validity of a shape. In OCCT a Shape (or its sub-shapes) is considered valid if it meets certain criteria. If the shape is found as invalid, it can be fixed by tools from *ShapeAnalysis, ShapeUpgrade* and *ShapeFix* packages.
1886
1887However, it is important to note that class *BRepCheck_Analyzer* is just a tool that can have its own problems; this means that due to a specific factor(s) this tool can sometimes provide a wrong result.
1888
1889Let us consider the following example:
1890
3f812249 1891The Analyzer checks distances between couples of 3D check-points <i>(Pi, PSi)</i> of edge *E* on face *F*. Point *Pi* is obtained from the 3D curve (at the parameter *ti*) of the edge. *PSi* is obtained from 2D curve (at the parameter *ti*) of the edge on surface *S* of face *F*. To be valid the distance should be less than *Tol(E)* for all couples of check-points. The number of these check-points is a predefined value (e.g. 23).
1a457208 1892
1893Let us consider the case when edge *E* is recognized valid (in terms of *BRepCheck_Analyzer*).
1894
3f812249 1895Further, after some operation, edge *E* is split into two edges *E1* and *E2*. Each split edge has the same 3D curve and 2D curve as the original edge *E*.
1a457208 1896
1897Let us check *E1* (or E2). The Analyzer again checks the distances between the couples of check-points points <i>(Pi, PSi)</i>. The number of these check-points is the same constant value (23), but there is no guarantee that the distances will be less than *Tol(E)*, because the points chosen for *E1* are not the same as for *E*.
1898
1899Thus, if *E1* is recognized by the Analyzer as non-valid, edge *E* should also be non-valid. However *E* has been recognized as valid. Thus the Analyzer gives a wrong result for *E*.
1900
1901The fact that the argument is a valid shape (in terms of *BRepCheck_Analyzer*) is a necessary but insufficient requirement to produce a valid result of the Algorithms.
1902
1903@subsubsection occt_algorithms_10_1_3 Pure self-interference
1904
1905The argument should not be self-interfered, i.e. all sub-shapes of the argument that have geometrical coincidence through any topological entities (vertices, edges, faces) should share these entities.
1906
1907#### Example 1: Compound of two edges
1908The compound of two edges *E1* and *E2* is a self-interfered shape and cannot be used as the argument of the Algorithms.
1909
1910@figure{/user_guides/boolean_operations/images/operations_image036.svg, "Compound of two edges"}
1911
1912#### Example 2: Self-interfered Edge
1913The edge *E* is a self-interfered shape and cannot be used as an argument of the Algorithms.
1914
1915@figure{/user_guides/boolean_operations/images/operations_image037.svg, "Self-interfered Edge"}
1916
1917#### Example 3: Self-interfered Face
1918The face *F* is a self-interfered shape and cannot be used as an argument of the Algorithms.
1919
1920@figure{/user_guides/boolean_operations/images/operations_image038.svg, "Self-interfered Face"}
1921
1922#### Example 4: Face of Revolution
1923The face *F* has been obtained by revolution of edge *E* around line *L*.
1924
1925@figure{/user_guides/boolean_operations/images/operations_image039a.png, "Face of Revolution: Arguments"}
1926@figure{/user_guides/boolean_operations/images/operations_image039b.png, "Face of Revolution: Result"}
1927
1928In spite of the fact that face *F* is valid (in terms of *BRepCheck_Analyzer*) it is a self-interfered shape and cannot be used as the argument of the Algorithms.
1929
1930@subsubsection occt_algorithms_10_1_4 Self-interferences due to tolerances
1931#### Example 1: Non-closed Edge
1932
1933Let us consider edge *E* based on a non-closed circle. @figure{/user_guides/boolean_operations/images/operations_image040.png, "Edge based on a non-closed circle"}
1934
1935The distance between the vertices of *E* is *D=0.69799*. The values of the tolerances *Tol(V1)=Tol(V2)=0.5*.
1936@figure{/user_guides/boolean_operations/images/operations_image041.png, "Distance and Tolerances"}
1937
1938In spite of the fact that the edge *E* is valid in terms of *BRepCheck_Analyzer*, it is a self-interfered shape because its vertices are interfered. Thus, edge *E* cannot be used as an argument of the Algorithms.
1939
1940#### Example 2: Solid containing an interfered vertex
1941
1942Let us consider solid *S* containing vertex V. @figure{/user_guides/boolean_operations/images/operations_image042.png, "Solid containing an interfered vertex"}
1943
1944The value of tolerance Tol(V)= 50.000075982061.
1945
1946@figure{/user_guides/boolean_operations/images/operations_image043.png, "Tolerance"}
1947
1948In spite of the fact that solid *S* is valid in terms of *BRepCheck_Analyzer* it is a self-interfered shape because vertex *V* is interfered with a lot of sub-shapes from *S* without any topological connection with them. Thus solid *S* cannot be used as an argument of the Algorithms.
1949
1950@subsubsection occt_algorithms_10_1_5 Parametric representation
1951The parameterization of some surfaces (cylinder, cone, surface of revolution) can be the cause of limitation.
1952
1953#### Example 1: Cylindrical surface
1954The parameterization range for cylindrical surface is:
1955
e9e33e91 1956@figure{/user_guides/boolean_operations/images/boolean_image135.png}
1a457208 1957
1958The range of *U* coordinate is always restricted while the range of *V* coordinate is non-restricted.
1959
1960Let us consider a cylinder-based *Face 1* with radii *R=3* and *H=6*.
1961
1962@figure{/user_guides/boolean_operations/images/operations_image044.png, "Face 1"}
1963
1964@figure{/user_guides/boolean_operations/images/operations_image045.png, "P-Curves for Face 1"}
1965
1966Let us also consider a cylinder-based *Face 2* with radii *R=3000* and *H=6000* (resulting from scaling Face 1 with scale factor *ScF=1000*).
1967
1968@figure{/user_guides/boolean_operations/images/operations_image046.png, "Face 2"}
1969
1970@figure{/user_guides/boolean_operations/images/operations_image047.png, "P-Curves for Face 2"}
1971
1972Please, pay attention to the Zoom value of the Figures.
1973
1974It is obvious that starting with some value of *ScF*, e.g. *ScF>1000000*, all sloped p-Curves on *Face 2* will be almost vertical. At least, there will be no difference between the values of angles computed by standard C Run-Time Library functions, such as *double acos(double x)*. The loss of accuracy in computation of angles can cause failure of some BP sub-algorithms, such as building faces from a set of edges or building solids from a set of faces.
1975
1976
e9e33e91 1977@subsubsection occt_algorithms_10_1_6 Using tolerances of vertices to fix gaps
1a457208 1978
1979It is possible to create shapes that use sub-shapes of lower order to avoid gaps in the tolerance-based data model.
1980
1981Let us consider the following example:
1982
1983@figure{/user_guides/boolean_operations/images/operations_image048.png, "Example"}
1984
1985* Face *F* has two edges *E1* and *E2* and two vertices, the base plane is <i>{0,0,0, 0,0,1}</i>;
1986* Edge *E1* is based on line <i>{0,0,0, 1,0,0}, Tol(E1) = 1.e-7; </i>
1987* Edge *E2* is based on line <i>{0,1,0, 1,0,0}, Tol(E2) = 1.e-7;</i>
1988* Vertex *V1*, point <i>{0,0.5,0}, Tol(V1) = 1;</i>
1989* Vertex *V2*, point <i>{10,0.5,0}, Tol(V2) = 1;</i>
1990* Face *F* is valid (in terms of *BRepCheck_Analyzer*).
1991
1992The values of tolerances *Tol(V1)* and *Tol(V2)* are big enough to fix the gaps between the ends of the edges, but the vertices *V1* and *V2* do not contain any information about the trajectories connecting the corresponding ends of the edges. Thus, the trajectories are undefined. This will cause failure of some sub-algorithms of BP. For example, the sub-algorithms for building faces from a set of edges use the information about all edges connected in a vertex. The situation when a vertex has several pairs of edges such as above will not be solved in a right way.
1993
1994
1995@subsection occt_algorithms_11_1 Intersection problems
1996@subsubsection occt_algorithms_11_1_1 Pure intersections and common zones
1997
1998#### Example: Intersecting Edges
1999
2000Let us consider the intersection between two edges:
2001* *E1* is based on a line: <i>{0,-10,0, 1,0,0}, Tol(E1)=2.</i>
2002* *E2* is based on a circle: <i>{0,0,0, 0,0,1}, R=10, Tol(E2)=2.</i>
2003
2004@figure{/user_guides/boolean_operations/images/operations_image049.png, "Intersecting Edges"}
2005
2006The result of pure intersection between *E1* and *E2* is vertex *Vx {0,-10,0}*.
2007
2008The result of intersection taking into account tolerances is the common zone *CZ* (part of 3D-space where the distance between the curves is less than or equals to the sum of edge tolerances.
2009
2010The Intersection Part of Algorithms uses the result of pure intersection *Vx* instead of *CZ* for the following reasons:
2011* The Algorithms do not produce Common Blocks between edges based on underlying curves of explicitly different type (e.g. Line / Circle). If the curves have different types, the rule of thumb is that the produced result is of type **vertex**. This rule does not work for non-analytic curves (Bezier, B-Spline) and their combinations with analytic curves.
e9e33e91 2012* The algorithm of intersection between two surfaces *IntPatch_Intersection* does not compute *CZ* of the intersection between curves and points. So even if *CZ* were computed by Edge/Edge intersection algorithm, its result could not be treated by Face/Face intersection algorithm.
1a457208 2013
2014@subsubsection occt_algorithms_11_2_2 Tolerances and inaccuracies
2015
2016The following limitations result from modeling errors or inaccuracies.
2017
2018#### Example: Intersection of planar faces
2019
2020Let us consider two planar rectangular faces *F1* and *F2*.
2021
e9e33e91 2022The intersection curve between the planes is curve *C12*. The curve produces a new intersection edge *EC12*. The edge goes through vertices *V1* and *V2* thanks to big tolerance values of vertices *Tol(V1)* and *Tol(V2)*. So, two straight edges *E12* and *EC12* go through two vertices, which is impossible in this case.
1a457208 2023
2024@figure{/user_guides/boolean_operations/images/operations_image050.svg, "Intersecting Faces"}
2025
2026
2027The problem cannot be solved in general, because the length of *E12* can be infinite and the values of *Tol(V1)* and *Tol(V2)* theoretically can be infinite too.
2028
2029In a particular case the problem can be solved in several ways:
2030* Reduce, if possible, the values of *Tol(V1)* and *Tol(V2)* (refinement of *F1*).
2031* Analyze the value of *Tol(EC12)* and increase *Tol(EC12)* to get a common part between the edges *EC12* and *E12*. Then the common part will be rejected as there is an already existing edge *E12* for face *F1*.
2032
2033It is easy to see that if *C12* is slightly above the tolerance spheres of *V1* and *V2* the problem does not appear.
2034
2035#### Example: Intersection of two edges
2036
2037Let us consider two edges *E1* and *E2*, which have common vertices *V1* and *V2*. The edges *E1* and *E2* have 3D-curves *C1* and *C2. Tol(E1)=1.e<sup>-7</sup>, Tol(E2)=1.e<sup>-7</sup>.*
2038
2039*C1* practically coincides in 3D with *C2*. The value of deflection is *Dmax* (e.g. *Dmax=1.e<sup>-6</sup>*).
2040
2041@figure{/user_guides/boolean_operations/images/operations_image051.svg, "Intersecting Edges"}
2042
2043The evident and prospective result should be the Common Block between *E1* and *E2*. However, the result of intersection differs.
2044
2045@figure{/user_guides/boolean_operations/images/operations_image052.svg, "Result of Intersection"}
2046
e9e33e91 2047The result contains three new vertices *Vx1, Vx2* and *Vx3*, 8 new edges <i>(V1, Vx1, Vx2, Vx3, V2)</i> and no Common Blocks. This is correct due to the source data: *Tol(E1)=1.e<sup>-7</sup>, Tol(E2)=1.e<sup>-7</sup>* and <i>Dmax=1.e<sup>-6</sup></i>.
1a457208 2048
2049In this particular case the problem can be solved by several ways:
2050* Increase, if possible, the values *Tol(E1)* and *Tol(E2)* to get coincidence in 3D between *E1* and *E2* in terms of tolerance.
2051* Replace *E1* by a more accurate model.
2052
2053The example can be extended from 1D (edges) to 2D (faces).
2054
2055@figure{/user_guides/boolean_operations/images/operations_image053.svg, "Intersecting Faces"}
2056
2057The comments and recommendations are the same as for 1D case above.
2058
2059
2060@subsubsection occt_algorithms_11_2_3 Acquired Self-interferences
2061#### Example 1: Vertex and edge
2062
2063Let us consider vertex *V1* and edge *E2*.
2064
2065@figure{/user_guides/boolean_operations/images/operations_image054.svg, "Vertex and Edge"}
2066
2067Vertex *V1* interferes with vertices *V12* and *V22*.
2068So vertex *V21* should interfere with vertex *V22*, which is impossible because vertices *V21* and *V22* are the vertices of edge *E2*, thus *V21* is not equal to *V22*.
2069
e9e33e91 2070The problem cannot be solved in general, because the length can be as small as possible to provide validity of *E2* (in the extreme case: *Length (E2) = Tol(V21) + Tol(V22) + e,* where *e-> 0*).
1a457208 2071
2072In a particular case the problem can be solved by refinement of arguments, i.e. by decreasing the values of *Tol(V21)*, *Tol(V22)* and *Tol(V1)*.
2073
1a457208 2074#### Example 2: Vertex and wire
2075
2076Let us consider vertex *V2* and wire consisting of edges *E11* and *E12*.
2077
2078@figure{/user_guides/boolean_operations/images/operations_image055.svg, "Vertex and Wire"}
2079
2080The arguments themselves are not self-intersected.
2081Vertex *V2* interferes with edges *E11* and *E12*. Thus, edge *E11* should interfere with edge *E22*, but it is impossible because edges *E11* and *E12* cannot interfere by the condition.
2082
2083The cases when a non-self-interfered argument (or its sub-shapes) become interfered due to the intersections with other arguments (or their sub-shapes) are considered as limitations for the Algorithms.
2084
e9e33e91 2085@section occt_algorithms_11a Advanced Options
1a457208 2086
e9e33e91 2087The previous chapters describe so called Basic Operations. Most of tasks can be solved using Basic Operations. Nonetheless, there are cases that can not be solved straightforwardly by Basic Operations. The tasks are considered as limitations of Basic Operations.
1a457208 2088
e9e33e91 2089The chapter is devoted to Advanced Options. In some cases the usage of Advanced Options allows overcoming the limitations, improving the quality of the result of operations, robustness and performance of the operators themselves.
1a457208 2090
e9e33e91 2091@subsection occt_algorithms_11a_1 Fuzzy Boolean Operation
1a457208 2092
e9e33e91 2093Fuzzy Boolean operation is the option of Basic Operations (GFA, BOA, PA and SA), in which additional user-specified tolerance is used. This option allows operators to handle robustly cases of touching and near-coincident, misalignment entities of the arguments.
1a457208 2094
e9e33e91 2095The Fuzzy option is useful on the shapes with gaps or embeddings between the entities of these shapes which are not covered by the tolerance values of these entities. Such shapes can be the result of modeling mistakes, or translating process, or import from other systems with loss of precision, or errors in some algorithms.
1a457208 2096
e9e33e91 2097Most likely, the Basic Operations will give unsatisfactory results on such models. The result may contain unexpected and unwanted small entities, faulty entities (in terms of *BRepCheck_Analyzer*), or there can be no result at all.
1a457208 2098
3f812249 2099With the Fuzzy option it is possible to get the expected result -- it is just necessary to define the appropriate value of fuzzy tolerance for the operation. To define that value it is necessary to measure the value of the gap (or the value of embedding depth) between the entities of the models, slightly increase it (to make the shifted entities coincident in terms of their tolerance plus the additional one) and pass it to the algorithm.
1a457208 2100
e9e33e91 2101Fuzzy option is included in interface of Intersection Part (class *BOPAlgo_PaveFiller*) and application programming interface (class *BRepAlgoAPI_BooleanOperation*)
1a457208 2102
e9e33e91 2103@subsection occt_algorithms_11a_2 Examples
2104The following examples demonstrate the advantages of usage Fuzzy option operations over the Basic Operations in typical situations.
1a457208 2105
e9e33e91 2106@subsubsection occt_algorithms_11a_1_1 Case 1
1a457208 2107
e9e33e91 2108In this example the cylinder (shown in yellow and transparent) is subtracted from the box (shown in red). The cylinder is shifted by 5e<sup>-5</sup> relatively to the box along its axis (the distance between rear faces of the box and cylinder is 5e<sup>-5</sup>).
1a457208 2109
e9e33e91 2110@figure{/user_guides/boolean_operations/images/boolean_image121.png}
2111
2112The following results are obtained using Basic Operations and the Fuzzy ones with the fuzzy value 5e<sup>-5</sup>:
1a457208 2113
e9e33e91 2114@figure{/user_guides/boolean_operations/images/boolean_image122.png, "Result of CUT operation obtained with Basic Operations"}
1a457208 2115
e9e33e91 2116@figure{/user_guides/boolean_operations/images/boolean_image123.png, "Result of CUT operation obtained with Fuzzy Option"}
1a457208 2117
e9e33e91 2118In this example Fuzzy option allows eliminating a very thin part of the result shape produced by Basic algorithm due to misalignment of rear faces of the box and the cylinder.
1a457208 2119
e9e33e91 2120@subsubsection occt_algorithms_11a_1_2 Case 2
1a457208 2121
e9e33e91 2122In this example two boxes are fused. One of them has dimensions 10*10*10, and the other is 10*10.000001*10.000001 and adjacent to the first one. There is no gap in this case as the surfaces of the neighboring faces coincide, but one box is slightly greater than the other.
1a457208 2123
e9e33e91 2124@figure{/user_guides/boolean_operations/images/boolean_image124.png}
1a457208 2125
e9e33e91 2126The following results are obtained using Basic Operations and the Fuzzy ones with the fuzzy value 1e<sup>-6</sup>:
1a457208 2127
e9e33e91 2128@figure{/user_guides/boolean_operations/images/boolean_image125.png, "Result of CUT operation obtained with Basic Operations"}
1a457208 2129
e9e33e91 2130@figure{/user_guides/boolean_operations/images/boolean_image126.png, "Result of CUT operation obtained with Fuzzy Option"}
1a457208 2131
e9e33e91 2132In this example Fuzzy option allows eliminating an extremely narrow face in the result produced by Basic operation.
1a457208 2133
e9e33e91 2134@subsubsection occt_algorithms_11a_1_3 Case 3
1a457208 2135
e9e33e91 2136In this example the small planar face (shown in orange) is subtracted from the big one (shown in yellow). There is a gap 1e<sup>-5</sup> between the edges of these faces.
1a457208 2137
e9e33e91 2138@figure{/user_guides/boolean_operations/images/boolean_image127.png}
1a457208 2139
e9e33e91 2140The following results are obtained using Basic Operations and the Fuzzy ones with the fuzzy value 1e<sup>-5</sup>:
1a457208 2141
e9e33e91 2142@figure{/user_guides/boolean_operations/images/boolean_image128.png, "Result of CUT operation obtained with Basic Operations"}
1a457208 2143
e9e33e91 2144@figure{/user_guides/boolean_operations/images/boolean_image129.png, "Result of CUT operation obtained with Fuzzy Option"}
1a457208 2145
e9e33e91 2146In this example Fuzzy options eliminated a pin-like protrusion resulting from the gap between edges of the argument faces.
1a457208 2147
e9e33e91 2148@subsubsection occt_algorithms_11a_1_4 Case 4
1a457208 2149
e9e33e91 2150In this example the small edge is subtracted from the big one. The edges are overlapping not precisely, with max deviation between them equal to 5.28004e<sup>-5</sup>. We will use 6e<sup>-5</sup> value for Fuzzy option.
1a457208 2151
e9e33e91 2152@figure{/user_guides/boolean_operations/images/boolean_image130.png}
1a457208 2153
e9e33e91 2154The following results are obtained using Basic Operations and the Fuzzy ones with the fuzzy value 6e<sup>-5</sup>:
1a457208 2155
e9e33e91 2156@figure{/user_guides/boolean_operations/images/boolean_image131.png, "Result of CUT operation obtained with Basic Operations"}
2157
2158@figure{/user_guides/boolean_operations/images/boolean_image132.png, "Result of CUT operation obtained with Fuzzy Option"}
2159
2160This example stresses not only the validity, but also the performance issue. The usage of Fuzzy option with the appropriate value allows processing the case much faster than with the pure Basic operation. The performance gain for the case is 45 (Processor: Intel(R) Core(TM) i5-3450 CPU @ 3.10 GHz).
2161
2162@section occt_algorithms_11b Usage
2163
2164The chapter contains some examples of the OCCT Boolean Component usage. The usage is possible on two levels: C++ and Tcl.
2165
2166@subsection occt_algorithms_11b_1 Package BRepAlgoAPI
2167
2168The package *BRepAlgoAPI* provides the Application Programming Interface of the Boolean Component.
2169
2170The package consists of the following classes:
3f812249 2171* *BRepAlgoAPI_Algo* -- the root class that provides the interface for algorithms.
2172* *BRepAlgoAPI_BuilderAlgo* -- the class API level of General Fuse algorithm.
2173* *BRepAlgoAPI_BooleanOperation* -- the root class for the classes *BRepAlgoAPI_Fuse*. *BRepAlgoAPI_Common*, *BRepAlgoAPI_Cut* and *BRepAlgoAPI_Section*.
2174* *BRepAlgoAPI_Fuse* -- the class provides Boolean fusion operation.
2175* *BRepAlgoAPI_Common* -- the class provides Boolean common operation.
2176* *BRepAlgoAPI_Cut* -- the class provides Boolean cut operation.
2177* *BRepAlgoAPI_Section* -- the class provides Boolean section operation.
e9e33e91 2178
2179@figure{/user_guides/boolean_operations/images/operations_image065.svg, "Diagram of BRepAlgoAPI package"}
2180
1511c7e9 2181The detailed description of the classes can be found in the corresponding .hxx files. The examples are below in this chapter.
e9e33e91 2182
2183@subsection occt_algorithms_11b_2 Package BOPTest
2184The package *BOPTest* provides the usage of the Boolean Component on Tcl level. The method *BOPTest::APICommands* contains corresponding Tcl commands:
2185
3f812249 2186* *bapibuild* -- for General Fuse Operator;
2187* *bapibop* -- for Boolean Operator and Section Operator.
e9e33e91 2188
2189The examples of how to use the commands are below in this chapter.
2190
2191@subsubsection occt_algorithms_11b_2_1 Case 1 General Fuse operation
2192
2193The following example illustrates how to use General Fuse operator:
2194
2195#### C++ Level
2196
2197~~~~
2198#include <TopoDS_Shape.hxx>
2199#include <TopTools_ListOfShape.hxx>
2200#include <BRepAlgoAPI_BuilderAlgo.hxx>
2201 {…
2202 Standard_Boolean bRunParallel;
2203 Standard_Integer iErr;
2204 Standard_Real aFuzzyValue;
2205 BRepAlgoAPI_BuilderAlgo aBuilder;
2206 //
2207 // prepare the arguments
2208 TopTools_ListOfShape& aLS=…;
2209 //
2210 bRunParallel=Standard_True;
2211 aFuzzyValue=2.1e-5;
2212 //
2213 // set the arguments
2214 aBuilder.SetArguments(aLS);
2215 // set parallel processing mode
2216 // if bRunParallel= Standard_True : the parallel processing is switched on
2217 // if bRunParallel= Standard_False : the parallel processing is switched off
2218 aBuilder.SetRunParallel(bRunParallel);
2219 //
2220 // set Fuzzy value
2221 // if aFuzzyValue=0.: the Fuzzy option is off
2222 // if aFuzzyValue>0.: the Fuzzy option is on
2223 aBuilder.SetFuzzyValue(aFuzzyValue);
2224 //
2225 // run the algorithm
2226 aBuilder.Build();
2227 iErr=aBuilder.ErrorStatus();
2228 if (iErr) {
2229 // an error treatment
2230 return;
2231 }
2232 //
2233 // result of the operation aR
2234 const TopoDS_Shape& aR=aBuilder.Shape();
2235
2236}
2237~~~~
2238
2239#### Tcl Level
2240
2241~~~~
2242# prepare the arguments
2243box b1 10 10 10
2244box b2 3 4 5 10 10 10
2245box b3 5 6 7 10 10 10
2246#
2247# clear inner contents
2248bclearobjects; bcleartools;
2249#
2250# set the arguments
2251baddobjects b1 b2 b3
2252# set parallel processing mode
2253# 1: the parallel processing is switched on
2254# 0: the parallel processing is switched off
2255brunparallel 1
2256# set Fuzzy value
2257# 0. : the Fuzzy option is off
2258# >0. : the Fuzzy option is on
2259bfuzzyvalue 0.
2260#
2261# run the algorithm
2262# r is the result of the operation
2263bapibuild r
2264~~~~
2265
2266@subsubsection occt_algorithms_11b_2_2 Case 2. Common operation
2267
2268The following example illustrates how to use Common operation:
2269
2270#### C++ Level
2271
2272~~~~
2273#include <TopoDS_Shape.hxx>
2274#include <TopTools_ListOfShape.hxx>
2275#include < BRepAlgoAPI_Common.hxx>
2276 {…
2277 Standard_Boolean bRunParallel;
2278 Standard_Integer iErr;
2279 Standard_Real aFuzzyValue;
2280 BRepAlgoAPI_Common aBuilder;
2281
2282 // perpare the arguments
2283 TopTools_ListOfShape& aLS=…;
2284 TopTools_ListOfShape& aLT=…;
2285 //
2286 bRunParallel=Standard_True;
2287 aFuzzyValue=2.1e-5;
2288 //
2289 // set the arguments
2290 aBuilder.SetArguments(aLS);
2291 aBuilder.SetTools(aLT);
2292 //
2293 // set parallel processing mode
2294 // if bRunParallel= Standard_True : the parallel processing is switched on
2295 // if bRunParallel= Standard_False : the parallel processing is switched off
2296 aBuilder.SetRunParallel(bRunParallel);
2297 //
2298 // set Fuzzy value
2299 // if aFuzzyValue=0.: the Fuzzy option is off
2300 // if aFuzzyValue>0.: the Fuzzy option is on
2301 aBuilder.SetFuzzyValue(aFuzzyValue);
2302 //
2303 // run the algorithm
2304 aBuilder.Build();
2305 iErr=aBuilder.ErrorStatus();
2306 if (iErr) {
2307 // an error treatment
2308 return;
2309 }
2310 //
2311 // result of the operation aR
2312 const TopoDS_Shape& aR=aBuilder.Shape();
2313
2314}
2315~~~~
2316
2317#### Tcl Level
2318
2319~~~~
2320# prepare the arguments
2321box b1 10 10 10
2322box b2 7 0 4 10 10 10
2323box b3 14 0 0 10 10 10
2324#
2325# clear inner contents
2326bclearobjects; bcleartools;
2327#
2328# set the arguments
2329baddobjects b1 b3
2330baddtools b2
2331#
2332# set parallel processing mode
2333# 1: the parallel processing is switched on
2334# 0: the parallel processing is switched off
2335brunparallel 1
2336#
2337# set Fuzzy value
2338# 0. : the Fuzzy option is off
2339# >0. : the Fuzzy option is on
2340bfuzzyvalue 0.
2341#
2342# run the algorithm
2343# r is the result of the operation
2344# 0 means Common operation
2345bapibop r 0
2346~~~~
2347
2348@subsubsection occt_algorithms_11b_2_3 Case 3. Fuse operation
2349
2350The following example illustrates how to use Fuse operation:
2351
2352#### C++ Level
2353
2354~~~~
2355#include <TopoDS_Shape.hxx>
2356#include <TopTools_ListOfShape.hxx>
2357#include < BRepAlgoAPI_Fuse.hxx>
2358 {…
2359 Standard_Boolean bRunParallel;
2360 Standard_Integer iErr;
2361 Standard_Real aFuzzyValue;
2362 BRepAlgoAPI_Fuse aBuilder;
2363
2364 // perpare the arguments
2365 TopTools_ListOfShape& aLS=…;
2366 TopTools_ListOfShape& aLT=…;
2367 //
2368 bRunParallel=Standard_True;
2369 aFuzzyValue=2.1e-5;
2370 //
2371 // set the arguments
2372 aBuilder.SetArguments(aLS);
2373 aBuilder.SetTools(aLT);
2374 //
2375 // set parallel processing mode
2376 // if bRunParallel= Standard_True : the parallel processing is switched on
2377 // if bRunParallel= Standard_False : the parallel processing is switched off
2378 aBuilder.SetRunParallel(bRunParallel);
2379 //
2380 // set Fuzzy value
2381 // if aFuzzyValue=0.: the Fuzzy option is off
2382 // if aFuzzyValue>0.: the Fuzzy option is on
2383 aBuilder.SetFuzzyValue(aFuzzyValue);
2384 //
2385 // run the algorithm
2386 aBuilder.Build();
2387 iErr=aBuilder.ErrorStatus();
2388 if (iErr) {
2389 // an error treatment
2390 return;
2391 }
2392 //
2393 // result of the operation aR
2394 const TopoDS_Shape& aR=aBuilder.Shape();
2395
2396}
2397~~~~
2398
2399#### Tcl Level
1a457208 2400
e9e33e91 2401~~~~
2402# prepare the arguments
2403box b1 10 10 10
2404box b2 7 0 4 10 10 10
2405box b3 14 0 0 10 10 10
2406#
2407# clear inner contents
2408bclearobjects; bcleartools;
2409#
2410# set the arguments
2411baddobjects b1 b3
2412baddtools b2
2413#
2414# set parallel processing mode
2415# 1: the parallel processing is switched on
2416# 0: the parallel processing is switched off
2417brunparallel 1
2418#
2419# set Fuzzy value
2420# 0. : the Fuzzy option is off
2421# >0. : the Fuzzy option is on
2422bfuzzyvalue 0.
2423#
2424# run the algorithm
2425# r is the result of the operation
2426# 1 means Fuse operation
2427bapibop r 1
2428~~~~
1a457208 2429
e9e33e91 2430@subsubsection occt_algorithms_11b_2_4 Case 4. Cut operation
1a457208 2431
e9e33e91 2432The following example illustrates how to use Cut operation:
1a457208 2433
e9e33e91 2434#### C++ Level
2435
2436~~~~
2437#include <TopoDS_Shape.hxx>
2438#include <TopTools_ListOfShape.hxx>
2439#include < BRepAlgoAPI_Cut.hxx>
2440 {…
2441 Standard_Boolean bRunParallel;
2442 Standard_Integer iErr;
2443 Standard_Real aFuzzyValue;
2444 BRepAlgoAPI_Cut aBuilder;
2445
2446 // perpare the arguments
2447 TopTools_ListOfShape& aLS=…;
2448 TopTools_ListOfShape& aLT=…;
2449 //
2450 bRunParallel=Standard_True;
2451 aFuzzyValue=2.1e-5;
2452 //
2453 // set the arguments
2454 aBuilder.SetArguments(aLS);
2455 aBuilder.SetTools(aLT);
2456 //
2457 // set parallel processing mode
2458 // if bRunParallel= Standard_True : the parallel processing is switched on
2459 // if bRunParallel= Standard_False : the parallel processing is switched off
2460 aBuilder.SetRunParallel(bRunParallel);
2461 //
2462 // set Fuzzy value
2463 // if aFuzzyValue=0.: the Fuzzy option is off
2464 // if aFuzzyValue>0.: the Fuzzy option is on
2465 aBuilder.SetFuzzyValue(aFuzzyValue);
2466 //
2467 // run the algorithm
2468 aBuilder.Build();
2469 iErr=aBuilder.ErrorStatus();
2470 if (iErr) {
2471 // an error treatment
2472 return;
2473 }
2474 //
2475 // result of the operation aR
2476 const TopoDS_Shape& aR=aBuilder.Shape();
2477
2478}
2479~~~~
1a457208 2480
e9e33e91 2481#### Tcl Level
1a457208 2482
e9e33e91 2483~~~~
2484# prepare the arguments
2485box b1 10 10 10
2486box b2 7 0 4 10 10 10
2487box b3 14 0 0 10 10 10
2488#
2489# clear inner contents
2490bclearobjects; bcleartools;
2491#
2492# set the arguments
2493baddobjects b1 b3
2494baddtools b2
2495#
2496# set parallel processing mode
2497# 1: the parallel processing is switched on
2498# 0: the parallel processing is switched off
2499brunparallel 1
2500#
2501# set Fuzzy value
2502# 0. : the Fuzzy option is off
2503# >0. : the Fuzzy option is on
2504bfuzzyvalue 0.
2505#
2506# run the algorithm
2507# r is the result of the operation
2508# 2 means Cut operation
2509bapibop r 2
2510~~~~
1a457208 2511
2512
e9e33e91 2513@subsubsection occt_algorithms_11b_2_5 Case 5. Section operation
1a457208 2514
e9e33e91 2515The following example illustrates how to use Section operation:
1a457208 2516
e9e33e91 2517#### C++ Level
1a457208 2518
e9e33e91 2519~~~~
2520#include <TopoDS_Shape.hxx>
2521#include <TopTools_ListOfShape.hxx>
2522#include < BRepAlgoAPI_Section.hxx>
2523 {…
2524 Standard_Boolean bRunParallel;
2525 Standard_Integer iErr;
2526 Standard_Real aFuzzyValue;
2527 BRepAlgoAPI_Section aBuilder;
2528
2529 // perpare the arguments
2530 TopTools_ListOfShape& aLS=…;
2531 TopTools_ListOfShape& aLT=…;
2532 //
2533 bRunParallel=Standard_True;
2534 aFuzzyValue=2.1e-5;
2535 //
2536 // set the arguments
2537 aBuilder.SetArguments(aLS);
2538 aBuilder.SetTools(aLT);
2539 //
2540 // set parallel processing mode
2541 // if bRunParallel= Standard_True : the parallel processing is switched on
2542 // if bRunParallel= Standard_False : the parallel processing is switched off
2543 aBuilder.SetRunParallel(bRunParallel);
2544 //
2545 // set Fuzzy value
2546 // if aFuzzyValue=0.: the Fuzzy option is off
2547 // if aFuzzyValue>0.: the Fuzzy option is on
2548 aBuilder.SetFuzzyValue(aFuzzyValue);
2549 //
2550 // run the algorithm
2551 aBuilder.Build();
2552 iErr=aBuilder.ErrorStatus();
2553 if (iErr) {
2554 // an error treatment
2555 return;
2556 }
2557 //
2558 // result of the operation aR
2559 const TopoDS_Shape& aR=aBuilder.Shape();
2560
2561}
2562~~~~
2563
2564#### Tcl Level
2565
2566~~~~
2567# prepare the arguments
2568box b1 10 10 10
2569box b2 3 4 5 10 10 10
2570box b3 5 6 7 10 10 10
2571#
2572# clear inner contents
2573bclearobjects; bcleartools;
2574#
2575# set the arguments
2576baddobjects b1 b3
2577baddtools b2
2578#
2579# set parallel processing mode
2580# 1: the parallel processing is switched on
2581# 0: the parallel processing is switched off
2582brunparallel 1
2583#
2584# set Fuzzy value
2585# 0. : the Fuzzy option is off
2586# >0. : the Fuzzy option is on
2587bfuzzyvalue 0.
2588#
2589# run the algorithm
2590# r is the result of the operation
2591# 4 means Section operation
2592bapibop r 4
2593~~~~