BooleanOperationsUtils.ExecuteBooleanOperation Method

BooleanOperationsUtilsExecuteBooleanOperation Method

Perform a boolean geometric operation between two solids, and return a new solid to represent the result.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public static Solid ExecuteBooleanOperation(
	Solid solid0,
	Solid solid1,
	BooleanOperationsType booleanType
)
Public Shared Function ExecuteBooleanOperation ( 
	solid0 As Solid,
	solid1 As Solid,
	booleanType As BooleanOperationsType
) As Solid
public:
static Solid^ ExecuteBooleanOperation(
	Solid^ solid0, 
	Solid^ solid1, 
	BooleanOperationsType booleanType
)
static member ExecuteBooleanOperation : 
        solid0 : Solid * 
        solid1 : Solid * 
        booleanType : BooleanOperationsType -> Solid 

Parameters

solid0  Solid
The first solid object. A copy will be taken of the input object, so any solid whether obtained from a Revit element or not would be accepted.
solid1  Solid
The second solid object. A copy will be taken of the input object, so any solid whether obtained from a Revit element or not would be accepted.
booleanType  BooleanOperationsType
boolean operation type.

Return Value

Solid
The result geometry.
Exceptions
ExceptionCondition
ArgumentNullException A non-optional argument was null
ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration
InvalidOperationException Failed to perform the Boolean operation for the two solids. This may be due to geometric inaccuracies in the solids, such as slightly misaligned faces or edges. If so, eliminating the inaccuracies by making sure the solids are accurately aligned may solve the problem. This also may be due to one or both solids having complexities such as more than two faces geometrically meeting along a single edge, or two coincident edges, etc. Eliminating such conditions, or performing a sequence of Boolean operations in an order that avoids such conditions, may solve the problem.
Example
private void ComputeIntersectionVolume(Solid solidA, Solid solidB)
{
    Solid intersection = BooleanOperationsUtils.ExecuteBooleanOperation(solidA, solidB, BooleanOperationsType.Intersect);
    double volumeOfIntersection = intersection.Volume;
}
Private Sub ComputeIntersectionVolume(solidA As Solid, solidB As Solid)
    Dim intersection As Solid = BooleanOperationsUtils.ExecuteBooleanOperation(solidA, solidB, BooleanOperationsType.Intersect)
    Dim volumeOfIntersection As Double = intersection.Volume
End Sub

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also