Mon, 12/12/2016 - 14:51
The next release of Open CASCADE Technology will feature the new mode of Boolean Operations - Gluing mode. It is implemented as an option for the algorithms in Boolean Component such as General Fuse, Boolean, Section, Volume Maker and Cells Builder operations. This option has been designed to speed up the computation of the intersection part of the algorithms for the special cases where the arguments do not really interfere each other, but are just touching or overlapping.
Application
The gluing options can be very useful when you know for sure (from modeling process) that the arguments passed to the operation are created in a way that faces of arguments do not intersect each other, but can be only touching or overlapping. For instance, after the CUT of two objects you might need to glue the result with the tool to make them share coinciding parts. Other example is fusing the shapes that have already been fused (intersected) but whose sharing might have been lost due to other modifications, or after reading shapes from STEP/IGES etc. Here are a few examples of shapes on which the Gluing will successfully work:
The result of fuse operation on these faces will contain three new faces, which can be easily united into one using the UnifySameDomain functionality.
The option should not be applied for the shapes if intersections of their faces will produce curve different from already present edges. The algorithms do not check if the option has been set correctly, and by setting an incorrect option you may get an invalid result. Below is the picture of the shapes on which the options cannot be applied:
The Gluing option supports two possibilities of overlapping/touching shapes:
- Shapes with partial coincidence like on the figures 1 and 4. For these shapes it will be necessary to compute the Edge/Face interferences to make p-curves of edges on faces, and to split the faces correctly;
- Shapes with full coincidence like on the figures 2 and 3. For these shapes there is no need to calculate neither Vertex/Face nor Edge/Face interferences. The faces in this case will not be split in the result. The performance improvement here should be even greater.
The performance improvement in Gluing mode is achieved due to avoiding computation of the most time-consuming interferences such as Edge/Face (for the shapes with fully coinciding faces) and Face/Face (in both variants). It is safe to exclude them because they will have no effect on the result. Without the Gluing options the algorithm will intersect all sub-shapes of the arguments with interfering bounding boxes. In some cases Gluing allows not only saving up to 90% of time but also avoiding errors in computation of intersections of tangential faces and increasing the robustness of the algorithms. For instance, setting the Glue option for the shapes on the figure 3 you avoid computation of 21 empty Face/Face interferences - each side face of bottom shape interferes with three side faces and one bottom face of the top shape, plus the top face of the bottom shape interferes with all side faces and the bottom face of the top shape.
Implementation
The Gluing option has been implemented as BOPAlgo_GlueEnum enumeration. There are following items in this enum:
- BOPAlgo_GlueOff - default value for the algorithms, Gluing is switched off;
- BOPAlgo_GlueShift - Glue option for shapes with partial coincidence (shifted shapes);
- BOPAlgo_GlueFull - Glue option for shapes with full coincidence.
This enum has been integrated into current development version of Open CASCADE Technology. To set the Gluing option for the operation it is necessary to call the SetGlue(BOPAlgo_GlueEnum) method with the appropriate value. For using the options in Draw the new bglue command has been implemented:
bglue : use bglue [0 (off) / 1 (shift) / 2 (full)]
Here is the example of fusing two boxes:
box b1 10 10 10 box b2 10 0 0 10 10 10 bglue 2 bfuse r b1 b2
The command bglue has a global effect, i.e. setting the glue option once will take effect for all subsequent operations till the next call of this command.
Similar algorithms in OCCT
There are a few algorithms in Open CASCADE Technology providing similar functionality: BRepTools_Quilt, BRepBuilderAPI_Sewing, BRepFeat_Gluer. All these algorithms solve particular problems. The Gluing in Boolean Component is more general operation. It can be applied for solving the same tasks, but usually with less performance. However, in some cases the Boolean Glue may produce better result than specialized tools. For instance, sewing of slightly overlapped faces is impossible without applying additional tolerance, which will lead to degradation of result. In some situations it may be easier to use Boolean Glue than BRepFeat_Gluer, because to use the latter you should know exactly which faces/edges are overlapping in the arguments before the operation. The Boolean Glue will find these parts automatically.
Test results
The following environment has been used to measure the performance improvements:
Processor | Intel(R) Core(TM) i5-4460 CPU @ 3.20 GHz |
System type | 64-bit Operating System |
Installed memory (RAM) | 16GB |
Operating System | Windows 10 Pro |
Compiler | Microsoft Visual Studio Professional 2013, Version 12.0.31101.00 Update 4 |
Open CASCADE | 7.1.0 development (master from 09/12/2016), optimized mode |
Case 1. Fusing solids into one solid.
The first test consists of 64 boxes arranged in four layers (to make this example more representative all lines and planes have been converted to b-splines):
There are two possibilities of fusing all these solid into one:
- Fuse all solids in one operation - it will be possible to use GlueShift option;
- Fuse solids in each layer separately using GlueFull option, and then fuse all layers together using GlueShift option.
Here are the results:
Approach | No Glue, sec | Using Glue, sec | Perf gain, % | Perf gain, times |
First approach | 45 | 11 | 68.9 | 3.2 |
Second approach | 34.7 | 4.5 | 87 | 7.71 |
Case 2. Fusing two halves of the ship
This example simulates the sewing operation.
Results on this case are the following:
No Glue, sec | Using Glue, sec | Perf gain, % | Perf gain, times |
1.15 | 0.0625 | 94.57 | 18.4 |
Case 3. Fusing objects after Cut
Assume you need to create the plate with the hole and the bolt fitting this hole. On the first step you have the whole plate and the bolt:
To make a hole in plate it is necessary to Cut bolt from the plate (gluing cannot be applied here as there will be intersections):
The next step is to Fuse the bolt with the cut plate to make them share coinciding faces. In this case there will be no real intersections between faces, thus we can use the GlueShift option. This saves about 90% of the time of the last operation.
Case 4. Making solids from the faces of the shape after reading from IGES
Imagine that you need to make the solids from the shape saved in IGES 5.1 format. In this format there is no information about shared parts, i.e. after reading its faces should be sewed. The result of sewing (BRepBuilderAPI_Sewing) is a shell(s) from which it is easy to create the solid(s). But the shell(s) will be invalid if there will be multi-connexity on edges in the shape, i.e. one edge will belong to more than two faces. The following picture illustrates such shape:
Sewing of such faces using BRepBuilderAPI_Sewing in non-manifold mode creates only one shell containing all faces of the shape. To make the solids from this shell it is necessary to split it first on the correct shells and make solids from them e.g. using Maker Volume algorithm in non-intersection mode. These two subsequent operations take about 0.09 seconds. Gluing option allows using the Maker Volume directly on non-sewed faces in intersection mode without significant degradation of the performance. In this case all solids will be produced in a single operation. This operation takes about 0.11 seconds.
Conclusion
Glue option is the next step in evolution of Boolean Component in Open CASCADE Technology. It adds flexibility for the algorithm and brings significant speed up of the operations on specific cases. It also allows more safe treatment of the shapes with tangential faces, without a need of their additional pre-processing (such as extension of faces which can be made to avoid appearance of tangency and making arguments really interfering). We will be pleased to know your experience with this new functionality. All your feedbacks will be very appreciated.
Sat, 10/02/2021 - 16:19
Thank you!
Wed, 06/22/2022 - 15:07
Thank you!