ExecuteBooleanOperation 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: 2015.0.0.0 (2015.0.0.0)
Since: 2012

Syntax

C#
public static Solid ExecuteBooleanOperation(
	Solid solid0,
	Solid solid1,
	BooleanOperationsType booleanType
)
Visual Basic
Public Shared Function ExecuteBooleanOperation ( _
	solid0 As Solid, _
	solid1 As Solid, _
	booleanType As BooleanOperationsType _
) As Solid
Visual C++
public:
static Solid^ ExecuteBooleanOperation(
	Solid^ solid0, 
	Solid^ solid1, 
	BooleanOperationsType booleanType
)

Parameters

solid0
Type: Autodesk.Revit.DB 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
Type: Autodesk.Revit.DB 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
Type: Autodesk.Revit.DB BooleanOperationsType
boolean operation type.

Return Value

The result geometry.

Examples

Copy C#
private void ComputeIntersectionVolume(Solid solidA, Solid solidB)
{
    Solid intersection = BooleanOperationsUtils.ExecuteBooleanOperation(solidA, solidB, BooleanOperationsType.Intersect);
    double volumeOfIntersection = intersection.Volume;
}
Copy VB.NET
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

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration
Autodesk.Revit.Exceptions InvalidOperationException Failed to perform the boolean operation for the two solids.

See Also