Gluing Options in Boolean Component

emv's picture


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.


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:

Fig1. Partially overlapping faces

The result of fuse operation on these faces will contain three new faces, which can be easily united into one using the UnifySameDomain functionality.

Fig 2. Faces touching in edges

Fig 3. Boxes with fully coinciding faces, or touching solids

Fig 4. Partially overlapping solids

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:

Fig 5. The shapes with intersecting faces

The Gluing option supports two possibilities of overlapping/touching shapes:

  1. 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;
  2. 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.


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):

Fig 6. 64 Solids

There are two possibilities of fusing all these solid into one:

  1. Fuse all solids in one operation - it will be possible to use GlueShift option;
  2. 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.

Fig 7. Fusing two halves of the ship

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:

Fig 8. Plate and a 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):

Fig 9. Plate with the hole

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.

Fig 10. Result of the operation - the cylindrical face is now shared between bolt and plate

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:

Fig 11. Non-sewed faces

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.


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.

Copyright 2011-2017
Contact us