BooleanResult

class compas_ifc.representations.BooleanResult(operator, first_operand, second_operand, name=None)

Bases: Geometry

A CSG boolean operation on two geometry operands.

Directly corresponds to IfcBooleanResult. Each operand can be any COMPAS geometry type — an Extrusion, a shape primitive (Box, Sphere, etc.), a HalfSpace, another BooleanResult, or any other geometry that the reading pipeline produces.

This is a recursive structure: complex CSG trees are represented as nested BooleanResult instances.

Parameters:
operatorstr

The boolean operator: "UNION", "INTERSECTION", or "DIFFERENCE".

first_operandGeometry

The first operand.

second_operandGeometry

The second operand.

namestr, optional

Optional name for the geometry.

Attributes:
operatorstr

The boolean operator.

first_operandGeometry

The first operand.

second_operandGeometry

The second operand.

namestr or None

Optional name.

Methods

__init__

copy

Return a deep copy of this boolean result.

depth

Return the depth of the CSG tree rooted at this node.

leaf_operands

Yield all leaf (non-BooleanResult) operands in the CSG tree.

surface_area

Surface area of the boolean result.

to_mesh

Convert the boolean result to a compas.datastructures.Mesh.

to_vertices_and_faces

Discretise the boolean result into vertices and faces.

transform

Transform the boolean result by transforming both operands.

volume

Volume of the boolean result.

Inherited Methods

ToString

Converts the instance to a string.

compute_aabb

Compute the axis-aligned bounding box of the geometry.

compute_obb

Compute the oriented bounding box of the geometry.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

rotate

Rotate the geometry.

rotated

Returns a rotated copy of this geometry.

scale

Scale the geometry.

scaled

Returns a scaled copy of this geometry.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

transformed

Returns a transformed copy of this geometry.

translate

Translate the geometry.

translated

Returns a translated copy of this geometry.

validate_data

Validate the data against the object's data schema.