An opening in an Autodesk Revit project or family document.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Syntax
Remarks
The object represents a variety of different types of openings:
- A rectangular opening in a wall created by two boundary points in a revit project.
- An opening created by a set of curves applied to a roof, floor, ceiling, beam, brace or column.
- A vertical shaft opening extending one or more levels.
- A simple opening created on a wall or ceiling in a family document.
Examples

private void Getinfo_Opening(Opening opening)
{
string message = "Opening:";
//get the host element of this opening
message += "\nThe id of the opening's host element is : " + opening.Host.Id.ToString();
//get the information whether the opening has a rect boundary
//If the opening has a rect boundary, we can get the geometry information from BoundaryRect property.
//Otherwise we should get the geometry information from BoundaryCurves property
if (opening.IsRectBoundary)
{
message += "\nThe opening has a rectangular boundary.";
//array contains two XYZ objects: the max and min coords of boundary
IList<XYZ> boundaryRect = opening.BoundaryRect;
//get the coordinate value of the min coordinate point
XYZ point = opening.BoundaryRect[0];
message += "\nMin coordinate point:(" + point.X + ", "
+ point.Y + ", " + point.Z + ")";
//get the coordinate value of the Max coordinate point
point = opening.BoundaryRect[1];
message += "\nMax coordinate point: (" + point.X + ", "
+ point.Y + ", " + point.Z + ")";
}
else
{
message += "\nThe opening doesn't have a rectangular boundary.";
// Get curve number
int curves = opening.BoundaryCurves.Size;
message += "\nNumber of curves is : " + curves;
for (int i = 0; i < curves; i++)
{
Autodesk.Revit.DB.Curve curve = opening.BoundaryCurves.get_Item(i);
// Get curve start point
message += "\nCurve start point: " + XYZToString(curve.GetEndPoint(0));
// Get curve end point
message += "; Curve end point: " + XYZToString(curve.GetEndPoint(1));
}
}
TaskDialog.Show("Revit",message);
}
// output the point's three coordinates
string XYZToString(XYZ point)
{
return "(" + point.X + ", " + point.Y + ", " + point.Z + ")";
}

Private Sub Getinfo_Opening(opening As Opening)
Dim message As String = "Opening:"
'get the host element of this opening
message += vbLf & "The id of the opening's host element is : " & opening.Host.Id.ToString()
'get the information whether the opening has a rect boundary
'If the opening has a rect boundary, we can get the geometry information from BoundaryRect property.
'Otherwise we should get the geometry information from BoundaryCurves property
If opening.IsRectBoundary Then
message += vbLf & "The opening has a rectangular boundary."
'array contains two XYZ objects: the max and min coords of boundary
Dim boundaryRect As IList(Of XYZ) = opening.BoundaryRect
'get the coordinate value of the min coordinate point
Dim point As XYZ = opening.BoundaryRect(0)
message += ((vbLf & "Min coordinate point:(" + point.X & ", ") + point.Y & ", ") + point.Z & ")"
'get the coordinate value of the Max coordinate point
point = opening.BoundaryRect(1)
message += ((vbLf & "Max coordinate point: (" + point.X & ", ") + point.Y & ", ") + point.Z & ")"
Else
message += vbLf & "The opening doesn't have a rectangular boundary."
' Get curve number
Dim curves As Integer = opening.BoundaryCurves.Size
message += vbLf & "Number of curves is : " & curves
For i As Integer = 0 To curves - 1
Dim curve As Autodesk.Revit.DB.Curve = opening.BoundaryCurves.Item(i)
' Get curve start point
message += vbLf & "Curve start point: " & XYZToString(curve.GetEndPoint(0))
' Get curve end point
message += "; Curve end point: " & XYZToString(curve.GetEndPoint(1))
Next
End If
TaskDialog.Show("Revit", message)
End Sub
' output the point's three coordinates
Private Function XYZToString(point As XYZ) As String
Return "(" & Convert.ToString(point.X) & ", " & Convert.ToString(point.Y) & ", " & Convert.ToString(point.Z) & ")"
End Function