Volume Maker algorithm


1. Introduction

Since the version 6.8.0 of Open CASCADE the new algorithm called “Volume Maker” is available. This algorithm builds the elementary volumes (solids) from a set of connected, intersecting, or nested shapes. The algorithm can be useful for splitting solids into parts, or constructing new solid(s) from set of intersecting or connected faces or shells. The algorithm creates only closed solids. In general case the result solids are non-manifold: fragments of the input shapes (wires, faces) located inside the solids are added as internal sub-shapes to these solids. Non-closed faces, free wires etc. located outside of any solid are excluded from the result.

2. Implementation and options of the algorithm

The algorithm is implemented in the class BOPAlgo_MakerVolume. It is based on the General Fuse (GF) algorithm (see General Fuse algorithm description). All the options of the GF algorithm such as possibility to run algorithm in parallel mode, fuzzy option (this option is new and will be available in the next release of OCCT, see Fuzzy Boolean Operations), and history support are also available in the new algorithm. The requirements for the arguments are the same as for the arguments of GF algorithm - they could be of any type, but each argument should be valid and not self-interfered. The algorithm allows disabling the intersection part (calculation of intersections between arguments). In that case the algorithm will run much faster, but the user should guarantee that the arguments do not interfere with each other, otherwise the result will be invalid (e.g. contain unexpected parts) or empty. This option is useful e.g. for building a solid from the faces of one shell or from the shapes that have already been intersected.

3. Usage

3.1. Draw level

To use the algorithm on the draw level the command mkvolume has been implemented. The usage of the command is following: Usage: mkvolume r b1 b2 ... [-c] [-ni] Options: -c - use this option to have input compounds considered as set of separate arguments (allows passing multiple arguments as one compound); -ni - use this option to disable the intersection of the arguments.

3.2. API level

The usage of the algorithm on the API level: BOPAlgo_MakerVolume aMV; BOPCol_ListOfShape aLS = …; // arguments Standard_Boolean bRunParallel = Standard_False; /* parallel or single mode (the default value is FALSE)*/ Standard_Boolean bIntersect = Standard_True; /* intersect or not the arguments (the default value is TRUE)*/ Standard_Real aTol = 0.0; /* fuzzy option (default value is 0)*/ // aMV.SetArguments(aLS); aMV.SetRunParallel(bRunParallel); aMV.SetIntersect(bIntersect); aMV.SetFuzzyValue(aTol); // aMV.Perform(); //perform the operation if (aMV.ErrorStatus()) { //check error status return; } // const TopoDS_Shape& aResult = aMV.Shape(); // result of the operation

4. Examples

4.1. Example 1

Creation of two solids formed by intersection of conical, cylindrical, and planar faces:

Arguments Results

4.2. Example 2

Creation of the solid from faces of the box and a wire inside it. There is nothing to intersect in this example, so the intersection part could be disabled:

Arguments Results

4.3. Example 3

Creation of 9832 solids from sphere and set of 63 planes:

Arguments Results

4.4. Example 4

Creating compartments on a ship defined by hull shell and a set of planes.

4.4.1. Example 4.1

The ship is divided on compartments by five transverse bulkheads and a deck – six compartments are created:

Arguments Results
4.4.2. Example 4.2

The ship is divided on compartments by six transverse bulkheads, deck, double bottom and forecastle deck – 15 compartments are created:

Arguments Results
Eugeny Maltchikov's picture

We are glad to present the new option of the Volume Maker algorithm which allows producing volumes without internal parts. It is available in current development version of OCCT. The option may be useful if you need to create only manifold volumes without any internal remains of the arguments. The difference between produced results is shown on the pictures below.

Arguments Result with internal parts Result without internal parts
8 faces and edge inside Solid with two internal faces and internal edge Solid without internal parts

As you can see on the images, the option does not prevent from the creation of the internal edges on faces, but still the result is much cleaner.

The new mode of the algorithm also allows speeding up the creation of the volumes due to avoidance of the classification of the internal/external parts of the arguments relatively the new volumes. Let’s compare the performances of the two modes on the examples 3 and 4.2 from the first post. To make the third example more representative it has been slightly modified without changing the result - the planar faces have been made bigger. Here are the new arguments:

These additional parts of the planar faces will not be included into resulting volumes, but they will have to be classified on internal/external state to include internal parts into result. With the option to avoid internal parts turned on this classification is unnecessary, because in this mode neither internal nor external parts have to be taken into result.
The following environment has been used to measure the performance:

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

The table below shows the results of comparison:

Example Create internal parts, sec Avoid internal parts, sec Performance gain, times
Example 3 56.87 22.90 2.48
Example 4.2 3.39 2.58 1.31

For both of these cases no internal parts have been created in both modes. Thus, in general the new mode should be faster (or the same) even for the cases without internal parts.

To use the new option on the API level you need to call the SetAvoidInternalShapes(const Standard_Boolean theAvoid) with the appropriate value. By default the new mode is switched off, i.e. the internal parts will be created.

To use the new option in DRAW the command mkvolume has been extended with the new optional parameter. To avoid the creation of internal parts type -ai after the arguments:

Usage: mkvolume r b1 b2 ... [-c] [-ni] [-ai]
 -c  - use this option if the arguments are compounds
       containing shapes that should be interfered;
 -ni - use this option if the arguments should not be interfered;
 -ai - use this option to avoid internal for solids shapes in the result.

Here is the simple example:

box b1 10 10 10
vertex v 5 5 5
mkvolume result b1 v -ni -ai ;# solid without a vertex inside is created
István Csanády's picture

Kudos, that's a very useful and great improvement.