occt: master 338434c7

Author Committer Branch Timestamp Parent
emv bugmaster master 2015-10-30 12:30:38 master 5201d3e6
Changeset 0026798: Boolean operations: keep desired cells and boundaries in the result

The algorithm is based on the General Fuse algorithm (GFA). The result of
GFA is all split parts of the Arguments.

The purpose of this algorithm is to provide the result with the content of:
1. Cells (parts) defined by the user;
2. Internal boundaries defined by the user.

In other words the algorithm should provide the possibility for the user
to add or remove any part to (from) result and remove any internal boundaries
between parts.

Requirements for the Data:
All the requirements of GFA for the DATA are inherited in this algorithm.
Plus all the arguments should have the same dimension.

Results:
The result of the algorithm is compound containing selected parts of
the basic type (VERTEX, EDGE, FACE or SOLID). The default result
is empty compound. It is possible to add any split part to the result
by using the methods AddToRessult() and AddAllToResult().
It is also possible to remove any part from the result by using methods
RemoveFromResult() and RemoveAllFromResult().
The method RemoveAllFromResult() is also suitable for clearing the result.

To remove Internal boundaries it is necessary to set the same material to the
parts between which the boundaries should be removed and call the method
RemoveInternalBoundaries(). The material should not be equal to 0, as this is
default material value. The boundaries between parts with this value
will not be removed.
One part cannot be added with the different materials.
It is also possible to remove the boundaries during combining the result.
To do this it is necessary to set the material for parts (not equal to 0)
and set the flag bUpdate to TRUE.
BUT for the arguments of the types FACE or EDGE it is recommended
to remove the boundaries in the end when the result is completely built.
It will help to avoid self-intersections in the result.

It is possible to create typed Containers from the parts added to result by using
method MakeContainers(). The type of the containers will depend on the type of
the arguments: WIRES for EEDGE, SHELLS for FACES and COMPSOLIDS for SOLIDS.
The result will be compound containing containers.
Adding of the parts to such result will not update containers. The result
compound will contain the containers and new added parts (of basic type).
Removing of the parts from such result may affect some containers if the
the parts that should be removed is in container. In this case this container
will be rebuilt without that part.

History:
The algorithm supports history information. This information available through
the methods IsDeleted() and Modified(). In DRAW Test Harness it is available
through the same commands as for Boolean Operations (bmodified and bisdeleted).

Examples:
1. API
BOPAlgo_CellsBuilder aCBuilder;
BOPCol_ListOfShape aLS = ...; // arguments
/* parallel or single mode (the default value is FALSE)*/
Standard_Boolean bRunParallel = Standard_False;
/* fuzzy option (default value is 0)*/
Standard_Real aTol = 0.0;
//
aCBuilder.SetArguments(aLS);
aCBuilder.SetRunParallel(bRunParallel);
aCBuilder.SetFuzzyValue(aTol);
//
aCBuilder.Perform();
if (aCBuilder.ErrorStatus()) { // check error status
  return;
}
/* empty compound, as nothing has been added yet */
const TopoDS_Shape& aRes = aCBuilder.Shape();
/* all split parts */
const TopoDS_Shape& aRes = aCBuilder.GetAllParts();
//
BOPCol_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result
BOPCol_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result
//
/* defines the material common for the cells, i.e.
   the boundaries between cells with the same material
   will be removed.
   By default it is set to 0. Thus, to remove some boundary
   the value of this variable should not be equal to 0 */
Standard_Integer iMaterial = ...;
/* defines whether to update the result right now or not */
Standard_Boolean bUpdate = ...;
// adding to result
aCBuilder.AddToResult(aLSToTake, aLSToAvoid, iMaterial, bUpdate);
aR = aCBuilder.Shape(); // the result
// removing of the boundaries
aCBuilder.RemoveInternalBoundaries();

// removing from result
aCBuilder.AddAllToResult();
aCBuilder.RemoveFromResult(aLSToTake, aLSToAvoid);
aR = aCBuilder.Shape(); // the result

2. DRAW Test Harness
psphere s1 15
psphere s2 15
psphere s3 15
ttranslate s1 0 0 10
ttranslate s2 20 0 10
ttranslate s3 10 0 0

bclearobjects; bcleartools
baddobjects s1 s2 s3
bfillds
# rx will contain all split parts
bcbuild rx
# add to result the part that is common for all three spheres
bcadd res s1 1 s2 1 s3 1 -m 1
# add to result the part that is common only for first and third shperes
bcadd res s1 1 s2 0 s3 1 -m 1
# remove internal boundaries
bcremoveint res

Added history support for Generated shapes (created in ShapeUpgrade_UnifySameDomain).

Methods AddToResult and RemoveFromResult have been documented in more details to clarify the procedure of adding and removing parts.

Adding external library to use ShapeUpgrade_UnifySameDomain.

Test-cases for issue #26798
add - src/BOPAlgo/BOPAlgo_CellsBuilder.cxx Diff File
add - src/BOPAlgo/BOPAlgo_CellsBuilder.hxx Diff File
mod - src/BOPAlgo/FILES Diff File
mod - src/BOPTest/BOPTest.cxx Diff File
mod - src/BOPTest/BOPTest.hxx Diff File
add - src/BOPTest/BOPTest_CellsCommands.cxx Diff File
mod - src/BOPTest/BOPTest_Objects.cxx Diff File
mod - src/BOPTest/BOPTest_Objects.hxx Diff File
mod - src/BOPTest/FILES Diff File
mod - src/DrawResources/TestCommands.tcl Diff File
mod - src/TKBO/EXTERNLIB Diff File
add - tests/boolean/cells_test/A1 Diff File
add - tests/boolean/cells_test/A2 Diff File
add - tests/boolean/cells_test/A3 Diff File
add - tests/boolean/cells_test/A4 Diff File
add - tests/boolean/cells_test/A5 Diff File
add - tests/boolean/cells_test/A6 Diff File
add - tests/boolean/cells_test/A7 Diff File
add - tests/boolean/cells_test/A8 Diff File
add - tests/boolean/cells_test/A9 Diff File
add - tests/boolean/cells_test/B1 Diff File
add - tests/boolean/cells_test/B2 Diff File
add - tests/boolean/cells_test/B3 Diff File
add - tests/boolean/cells_test/B4 Diff File
add - tests/boolean/cells_test/B5 Diff File
add - tests/boolean/cells_test/B6 Diff File
add - tests/boolean/cells_test/begin Diff File
add - tests/boolean/cells_test/C1 Diff File
add - tests/boolean/cells_test/C2 Diff File
add - tests/boolean/cells_test/C3 Diff File
add - tests/boolean/cells_test/C4 Diff File
add - tests/boolean/cells_test/C5 Diff File
add - tests/boolean/cells_test/C6 Diff File
add - tests/boolean/cells_test/C7 Diff File
add - tests/boolean/cells_test/C8 Diff File
add - tests/boolean/cells_test/C9 Diff File
add - tests/boolean/cells_test/D1 Diff File
add - tests/boolean/cells_test/D2 Diff File
add - tests/boolean/cells_test/D3 Diff File
add - tests/boolean/cells_test/D4 Diff File
add - tests/boolean/cells_test/D5 Diff File
add - tests/boolean/cells_test/E1 Diff File
add - tests/boolean/cells_test/E2 Diff File
add - tests/boolean/cells_test/E3 Diff File
add - tests/boolean/cells_test/E4 Diff File
add - tests/boolean/cells_test/E5 Diff File
add - tests/boolean/cells_test/E6 Diff File
add - tests/boolean/cells_test/E7 Diff File
add - tests/boolean/cells_test/E8 Diff File
add - tests/boolean/cells_test/E9 Diff File
add - tests/boolean/cells_test/F1 Diff File
add - tests/boolean/cells_test/F2 Diff File
add - tests/boolean/cells_test/F3 Diff File
add - tests/boolean/cells_test/F4 Diff File
add - tests/boolean/cells_test/F5 Diff File
add - tests/boolean/cells_test/F6 Diff File
add - tests/boolean/cells_test/F7 Diff File
add - tests/boolean/cells_test/F8 Diff File
add - tests/boolean/cells_test/F9 Diff File
add - tests/boolean/cells_test/G1 Diff File
add - tests/boolean/cells_test/G2 Diff File
add - tests/boolean/cells_test/G3 Diff File
add - tests/boolean/cells_test/G4 Diff File
add - tests/boolean/cells_test/G5 Diff File
add - tests/boolean/cells_test/G6 Diff File
add - tests/boolean/cells_test/G7 Diff File
add - tests/boolean/cells_test/G8 Diff File
add - tests/boolean/cells_test/H1 Diff File
add - tests/boolean/cells_test/H2 Diff File
add - tests/boolean/cells_test/H3 Diff File
add - tests/boolean/cells_test/H4 Diff File
add - tests/boolean/cells_test/I1 Diff File
add - tests/boolean/cells_test/I2 Diff File
mod - tests/boolean/grids.list Diff File