Skip to content

Boolean Operations Module

Boolean operations including union, intersection, and difference.

LightOcct::LBoolOp

Light OCCT wrapper for OCCT Boolean operations with enum + Handle pattern.

Provides type-safe boolean operation execution using OCCT BRepAlgoAPI internally. Follows Light OCCT architectural patterns: Enum + Handle pattern for type-safe operation storage POD structures for cross-language data exchange Wrapper methods using only Light OCCT types No OCCT types exposed in public interface Supported operations: FUSE: Union of two or more shapes (A ∪ B ∪ C...) COMMON: Intersection of two or more shapes (A ∩ B ∩ C...) CUT: Difference of two shapes (A - B) CUT21: Reverse difference of two shapes (B - A) SECTION: Boundary of intersection (∂(A ∩ B)) SPLIT: Split shapes using tool shapes

cpp
#include <light-occt/boolops/LBoolOp.hxx>

Quick Reference

Fields: myType, myResult

Factory Methods: CreateFuse(), CreateCommon(), CreateCut(), CreateCut21(), CreateSection(), CreateMultiFuse(), CreateMultiCommon(), CreateSplit()

Methods: GetType(), IsValid(), GetResult(), LBoolOp(), ~LBoolOp(), LBoolOp(), operator=(), Build(), Build(), CanBuild(), GetShape(), IsDone(), GetModified(), GetGenerated(), IsDeleted(), GetErrorCode(), GetWarningCode(), HasErrors(), HasWarnings(), SetFuzzyValue(), GetFuzzyValue(), SetGlueOption(), GetGlueOption(), SetNonDestructive(), IsNonDestructive(), SetUseParallelMode(), UseParallelMode()

Types: OperationType, TypeEnum


Fields

myType

cpp
BooleanOperationType myType;

myResult

cpp
BooleanOperationResult myResult;

Methods

Factory Methods

CreateFuse

Create fuse (union) operation between two shapes.

cpp
static LBoolOp CreateFuse(const  & LShape shape1, const  & LShape shape2, const  & BooleanOperationData config);

shape1 First input shape shape2 Second input shape config Operation configuration (optional) Boolean operation configured for fuse

Parameters:

  • shape1 - First input shape shape2 Second input shape config Operation configuration (optional) Boolean operation configured for fuse
  • shape2 - Second input shape config Operation configuration (optional) Boolean operation configured for fuse
  • config - Operation configuration (optional) Boolean operation configured for fuse
CreateCommon

Create common (intersection) operation between two shapes.

cpp
static LBoolOp CreateCommon(const  & LShape shape1, const  & LShape shape2, const  & BooleanOperationData config);

shape1 First input shape shape2 Second input shape config Operation configuration (optional) Boolean operation configured for common

Parameters:

  • shape1 - First input shape shape2 Second input shape config Operation configuration (optional) Boolean operation configured for common
  • shape2 - Second input shape config Operation configuration (optional) Boolean operation configured for common
  • config - Operation configuration (optional) Boolean operation configured for common
CreateCut

Create cut (difference) operation between two shapes.

cpp
static LBoolOp CreateCut(const  & LShape shape1, const  & LShape shape2, const  & BooleanOperationData config);

shape1 First input shape (object to cut from) shape2 Second input shape (cutting tool) config Operation configuration (optional) Boolean operation configured for cut

Parameters:

  • shape1 - First input shape (object to cut from) shape2 Second input shape (cutting tool) config Operation configuration (optional) Boolean operation configured for cut
  • shape2 - Second input shape (cutting tool) config Operation configuration (optional) Boolean operation configured for cut
  • config - Operation configuration (optional) Boolean operation configured for cut
CreateCut21

Create reverse cut (B - A) operation between two shapes.

cpp
static LBoolOp CreateCut21(const  & LShape shape1, const  & LShape shape2, const  & BooleanOperationData config);

shape1 First input shape (cutting tool) shape2 Second input shape (object to cut from) config Operation configuration (optional) Boolean operation configured for reverse cut

Parameters:

  • shape1 - First input shape (cutting tool) shape2 Second input shape (object to cut from) config Operation configuration (optional) Boolean operation configured for reverse cut
  • shape2 - Second input shape (object to cut from) config Operation configuration (optional) Boolean operation configured for reverse cut
  • config - Operation configuration (optional) Boolean operation configured for reverse cut
CreateSection

Create section operation between two shapes.

cpp
static LBoolOp CreateSection(const  & LShape shape1, const  & LShape shape2, const  & BooleanOperationData config);

shape1 First input shape shape2 Second input shape config Operation configuration (optional) Boolean operation configured for section

Parameters:

  • shape1 - First input shape shape2 Second input shape config Operation configuration (optional) Boolean operation configured for section
  • shape2 - Second input shape config Operation configuration (optional) Boolean operation configured for section
  • config - Operation configuration (optional) Boolean operation configured for section
CreateMultiFuse

Create fuse (union) operation for multiple shapes.

cpp
static LBoolOp CreateMultiFuse(const std::vector<  > & LShape shapes, const  & BooleanOperationData config);

shapes of shapes to fuse together Vector config Operation configuration (optional) Boolean operation configured for multi-shape fuse

Parameters:

  • shapes - of shapes to fuse together Vector config Operation configuration (optional) Boolean operation configured for multi-shape fuse
  • config - Operation configuration (optional) Boolean operation configured for multi-shape fuse
CreateMultiCommon

Create common (intersection) operation for multiple shapes.

cpp
static LBoolOp CreateMultiCommon(const std::vector<  > & LShape shapes, const  & BooleanOperationData config);

shapes of shapes to intersect Vector config Operation configuration (optional) Boolean operation configured for multi-shape common

Parameters:

  • shapes - of shapes to intersect Vector config Operation configuration (optional) Boolean operation configured for multi-shape common
  • config - Operation configuration (optional) Boolean operation configured for multi-shape common
CreateSplit

Create split operation using multiple tool shapes.

cpp
static LBoolOp CreateSplit(const std::vector<  > & LShape arguments, const std::vector<  > & LShape tools, const  & SplitOperationData config);

arguments of shapes to be split Vector tools of tool shapes for splitting Vector config Split operation configuration (optional) Boolean operation configured for split

Parameters:

  • arguments - of shapes to be split Vector tools of tool shapes for splitting Vector config Split operation configuration (optional) Boolean operation configured for split
  • tools - of tool shapes for splitting Vector config Split operation configuration (optional) Boolean operation configured for split
  • config - Split operation configuration (optional) Boolean operation configured for split

Instance Methods

GetType

Get the current operation type.

cpp
BooleanOperationType GetType() const;

Operation type enumeration value

IsValid

Check if operation is valid (has been executed successfully).

cpp
bool IsValid() const;

True if operation is valid and completed

GetResult

Get operation result data.

cpp
BooleanOperationResult GetResult() const;

POD structure with execution metadata BooleanOperationResult

LBoolOp

Default constructor creates undefined operation.

cpp
 LBoolOp() const;
~LBoolOp

Destructor.

cpp
 ~LBoolOp() const;
LBoolOp

Copy constructor.

cpp
 LBoolOp(const  & LBoolOp other) const;
operator=

Assignment operator.

cpp
& LBoolOp operator=(const  & LBoolOp other) const;
Build

Execute the boolean operation.

cpp
bool Build() const;

True if operation completed successfully

Build

Execute the boolean operation with progress tracking.

cpp
bool Build(void * progressCallback) const;

progressCallback Optional progress callback function True if operation completed successfully

Parameters:

  • progressCallback - Optional progress callback function True if operation completed successfully
CanBuild

Check if the operation can be performed (inputs are valid).

cpp
bool CanBuild() const;

True if inputs are valid for the operation

GetShape

Get the resulting shape from the boolean operation.

cpp
LShape GetShape() const;

Result shape (valid only after successful ) Build()

IsDone

Check if the operation has been executed.

cpp
bool IsDone() const;

True if has been called Build()

GetModified

Get list of modified shapes from input arguments.

cpp
std::vector<  > LShape GetModified(const  & LShape inputShape) const;

inputShape Input shape to query for modifications of shapes modified from the input Vector

Parameters:

  • inputShape - Input shape to query for modifications of shapes modified from the input Vector
GetGenerated

Get list of generated shapes from input arguments.

cpp
std::vector<  > LShape GetGenerated(const  & LShape inputShape) const;

inputShape Input shape to query for generated shapes of shapes generated from the input Vector

Parameters:

  • inputShape - Input shape to query for generated shapes of shapes generated from the input Vector
IsDeleted

Check if an input shape was deleted during the operation.

cpp
bool IsDeleted(const  & LShape inputShape) const;

inputShape Input shape to query True if the shape was deleted

Parameters:

  • inputShape - Input shape to query True if the shape was deleted
GetErrorCode

Get error code from the last operation.

cpp
int GetErrorCode() const;

Error code (0 = success, non-zero = error)

GetWarningCode

Get warning code from the last operation.

cpp
int GetWarningCode() const;

Warning code (0 = no warnings, non-zero = warning)

HasErrors

Check if the operation completed without errors.

cpp
bool HasErrors() const;

True if no errors occurred

HasWarnings

Check if the operation generated warnings.

cpp
bool HasWarnings() const;

True if warnings were generated

SetFuzzyValue

Set fuzzy tolerance for the operation.

cpp
void SetFuzzyValue(double tolerance) const;

tolerance Fuzzy tolerance value (0.0 = precise)

Parameters:

  • tolerance - Fuzzy tolerance value (0.
GetFuzzyValue

Get current fuzzy tolerance setting.

cpp
double GetFuzzyValue() const;

Current fuzzy tolerance value

SetGlueOption

Set glue option for the operation.

cpp
void SetGlueOption(BooleanGlueType glueType) const;

glueType Glue type for adjacent faces

Parameters:

  • glueType - Glue type for adjacent faces
GetGlueOption

Get current glue option setting.

cpp
BooleanGlueType GetGlueOption() const;

Current glue type

SetNonDestructive

Enable or disable non-destructive mode.

cpp
void SetNonDestructive(bool nonDestructive) const;

nonDestructive Whether to preserve input shapes

Parameters:

  • nonDestructive - Whether to preserve input shapes
IsNonDestructive

Check if non-destructive mode is enabled.

cpp
bool IsNonDestructive() const;

True if input shapes are preserved

SetUseParallelMode

Enable or disable parallel processing.

cpp
void SetUseParallelMode(bool useParallel) const;

useParallel Whether to use parallel algorithms

Parameters:

  • useParallel - Whether to use parallel algorithms
UseParallelMode

Check if parallel processing is enabled.

cpp
bool UseParallelMode() const;

True if parallel algorithms are used

Type Definitions

OperationType

Operation type enumeration.

cpp
BooleanOperationType OperationType;

TypeEnum

Generic type alias for templates.

cpp
BooleanOperationType TypeEnum;

Released under the LGPL-2.1 License