Boolean operations are an advanced modeling operation only available in SMLib (not TSNLib). Booleans are accomplished with the IwMerge class which takes two objects as Input. Input objects can be manifold or non manifold. In other words, it is possible to boolean solids and surfaces. Some examples are listed below:

  • Solid Union - Solid yields the solid plus the portion of the second solid outside of the first solid
  • Solid Union - Surface yields the solid plus the portion of the surface outside of the solid.
  • Solid Intersect - Surface yields the portion of the surface which is inside of the volume of the solid.
  • Solid Difference - Surface yields the solid plus the portion of the surface inside of the solid. In some cases this may cut the solid into multiple regions.
  • Surface Difference - Solid yields the portion of the surface not inside the solid.
  • Surface Union - Surface yields the two surfaces plus attached by an intersection curve.
  • Surface Intersect - Surface yields just the intersection curves.
  • Surface Difference - Surface yields the first surface with the curves of intersection.

The primary operators are IwMerge::ManifoldBoolean or IwMerge::NonManifoldBoolean. A flag is used to specify the operation type union, difference, intersection, etc. The possible operation types are listed below.
IW_BO_UNION, // A Union B
IW_BO_INTERSECTION // A Intersection B
IW_BO_EXCLUSIVE_OR // ExclusiveOr = (A Union B) - (A intersect B)
IW_BO_MERGE // Merge B into A
IW_BO_PARTIAL_MERGE // Merge subset of B parts into A.
IW_BO_IMPRINT // A plus (A Intersect B)
IW_BO_EXTRACT_SEPARATE // Merge B into A placing the separate regions in separate breps.
IW_BO_SLICE // Slice a solid with a sheet and

The following code demonstrates how to set up and difference two Breps:

// base brep in difference
IwBrep *pBrep1 = ...;

// brep to subtract
IwBrep *pBrep2 = ...;

// Initialize merge object
IwMerge sMerge(crContext, pBrep1, pBrep2);

// Perform Boolean operation
IwBrep *pResult = NULL;
SER (sMerge.ManifoldBoolean(IW_BO_DIFFERENCE, pResult));

One great thing about having an underlying NMT representation is that the Boolean operation is now a closed operation. In other words you can not do a Boolean that would produce something you can not represent topologically. It is possible to union two solids which just touch along an edge or at a vertex whereas this is not a valid representation with traditional manifold operators.


The Merge operation is like the Boolean in that it combines the topologies from two separate Breps. The major difference being that the Merge only adds topology it does not remove any topology. For example the Merge of a box and a cylinder will contain all of the original edges and faces of both the cylinder and box plus any intersection edges. The Merge of two solids will typically create edges which have four or more faces and may have several regions.

The Non-Manifold Topology enables us to represent the results of the Merge completely and explicitly with a single topological structure. We do not need to break things up into separate volumes. You may merge any combination of wireframe, surfaces, open shells, solids, and non-manifold topology models. To invoke the merge operation you do the same thing as show above in the Boolean except that the operation you send in is "IW_BO_MERGE " instead of "IW_BO_DIFFERENCE ".


This operations allows the user to start with a brep and add a new surface one by one merging, intersecting, and sewing after every addition.


This is a convenience function to perform repeated boolean operations on a list of breps.


The MakeManifold operation produces a manifold solid from a non-manifold topology. It deletes excess faces, edges and vertices to get to either a manifold topology. The following shows how to utilize the operation.

// Make manifold by default uses all regions
// except the infinite region.
// Do not keep interior faces.
SER(pResult->MakeManifold(NULL, FALSE));

// Somehow we select which regions to keep in
// a cellular topology.
IwTArray<IwRegion*> sRegionsToKeep = ....;

// Remove all faces not bounding one of
// sRegionsToKeep. Note that any faces which
// between regions will also be kept.
SER (pResult->MakeManifold(sRegionsToKeep, TRUE));

Last updated on Apr 29, 2024.