mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0030145: Modeling Algorithms - Boolean Operations on open solids
Provide possibility to perform Boolean operations on open solids. Implementation of the new method *BOPAlgo_Builder::BuildBOP* performing the construction of the result shape for the given type of Boolean operation. This approach does not rely on the splits of solid to be correct and looks for the faces with necessary state relatively opposite solids to build the result solid. The call to this method is performed from BOP algorithm in case there were open solids in the arguments. Implementation of the draw command *buildbop* performing a call to the method above.
This commit is contained in:
@@ -1891,6 +1891,21 @@ The input data for this step is as follows:
|
||||
| 2.3 | Build solids <i>(SDi)</i> from *SFS*. | *BOPAlgo_BuilderSolid* |
|
||||
| 2.4 | Add the solids <i>(SDi)</i> to the result | |
|
||||
|
||||
@subsection occt_algorithms_bop_on_opensolids Boolean operations on open solids
|
||||
|
||||
The Boolean operations on open solids are tricky enough that the standard approach of Boolean operations for building the result, based on the splits of solids does not work.
|
||||
It happens because the algorithm for splitting solids (*BOPAlgo_BuilderSolid*) always tries to create the closed loops (shells) and make solids from them. But if the input solid is not closed, what can be expected from its splits?
|
||||
For performing Boolean Operations on open solids another approach is used, which does not rely on the splits of the solids to be correct, but tries to select the splits of faces, which are necessary for the given type of operation.
|
||||
The point here is that the type of Boolean operation clearly defines the states for the faces to be taken into result:
|
||||
- For **COMMON** operation all the faces from the arguments located inside any solid of the opposite group must be taken;
|
||||
- For **FUSE** operation all the faces from the arguments located outside of all solids of the opposite group must be taken;
|
||||
- For **CUT** operation all the faces from the Objects located outside of all solids of the Tools and all faces from the Tools located inside any solid of the Objects must be taken;
|
||||
- For **CUT21** operation all the faces from the Objects located inside any solid of the Tools and all faces from the Tools located outside of all solids of the Objects must be taken.
|
||||
From the selected faces the result solids are built. Please note, that the result may contain as normal (closed) solids as the open ones.
|
||||
|
||||
Even with this approach, the correct result of Boolean operation on open solids cannot be always guaranteed.
|
||||
This is explained by non-manifold nature of open solids: in some cases classification of a face depends on the point of the face chosen for classification.
|
||||
|
||||
@section occt_algorithms_10a Section Algorithm
|
||||
|
||||
@subsection occt_algorithms_10a_1 Arguments
|
||||
|
@@ -8370,6 +8370,62 @@ bfillds
|
||||
bsplit result
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_draw_bop_build_BOP_opensolids Alternative command for BOP
|
||||
|
||||
There is an alternative way to build the result of Boolean operation using the **buildbop** command, which should be run after any other building command, such as **bbuild** or **bbop** or **bsplit**.
|
||||
The command has the following features:
|
||||
* It is designed to work on open solids and thus uses the alternative approach for building the results (see @ref occt_algorithms_bop_on_opensolids "BOP on open solids" chapter of Boolean operations user guide).
|
||||
* It allows changing the groups of Objects and Tools of the operation (even excluding some of the arguments is possible).
|
||||
* History information for solids will be lost.
|
||||
|
||||
Syntax:
|
||||
~~~~
|
||||
buildbop result -o s1 [s2 ...] -t s3 [s4 ...] -op operation (common/fuse/cut/tuc)
|
||||
Where:
|
||||
result - result shape of the operation
|
||||
s1 s2 s3 s4 - arguments (solids) of the GF operation
|
||||
operation - type of boolean operation
|
||||
~~~~
|
||||
|
||||
**Example**
|
||||
~~~~
|
||||
box b1 10 10 10
|
||||
box b2 5 5 5 10 10 10
|
||||
box b3 -5 -5 -5 10 10 10
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects b1 b2 b3
|
||||
bfillds
|
||||
bbuild r
|
||||
|
||||
# bbop command will not be available as the tools are not set
|
||||
# but buildbop is available
|
||||
|
||||
# fuse of two
|
||||
buildbop r1 -o b1 -t b2 -op fuse
|
||||
buildbop r2 -o b2 -t b3 -op fuse
|
||||
|
||||
# fuse of all - it does not matter how the groups are formed
|
||||
buildbop r3 -o b1 b2 -t b3 -op fuse
|
||||
buildbop r4 -o b2 -t b1 b3 -op fuse
|
||||
buildbop r5 -o b1 b2 b3 -op fuse
|
||||
buildbop r6 -t b1 b2 b3 -op fuse
|
||||
|
||||
# common of two
|
||||
buildbop r7 -o b2 -t b1 -op common
|
||||
buildbop r8 -o b1 -t b3 -op common
|
||||
|
||||
# common
|
||||
buildbop r9 -o b1 -t b2 b3 -op common
|
||||
|
||||
# cut
|
||||
buildbop r10 -o b1 -t b2 b3 -op cut
|
||||
|
||||
# opposite cut
|
||||
buildbop r11 -o b1 -t b2 b3 -op tuc
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_draw_bop_build_CB Cells Builder
|
||||
|
||||
See the @ref occt_algorithms_10c_Cells_1 "Cells Builder Usage" for the Draw usage of Cells Builder algorithm.
|
||||
|
Reference in New Issue
Block a user