DesignOption Property


Returns the design option to which the element belongs.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public DesignOption DesignOption { get; }
Visual Basic
Public ReadOnly Property DesignOption As DesignOption
	Get
Visual C++
public:
property DesignOption^ DesignOption {
	DesignOption^ get ();
}

Remarks

If the element is not in a design option, i.e. in the main model, then this property will return a null reference ( Nothing in Visual Basic) .

Examples

Copy C#
void Getinfo_DesignOption(Document document)
{
    // Get the selected Elements in the Active Document
    UIDocument uidoc = new UIDocument(document);
    ICollection<ElementId> selectedIds = uidoc.Selection.GetElementIds();

    foreach (ElementId id in selectedIds)
    {
        Element element = document.GetElement(id);
        //Use the DesignOption property of Element
        if (element.DesignOption != null)
        {
            TaskDialog.Show("Revit",element.DesignOption.Name.ToString());
        }
    }
}
Copy VB.NET
Private Sub Getinfo_DesignOption(document As Document)
    ' Get the selected Elements in the Active Document
    Dim uidoc As New UIDocument(document)
    Dim selectedIds As ICollection(Of ElementId) = uidoc.Selection.GetElementIds()

    For Each id As ElementId In selectedIds
        Dim element As Element = document.GetElement(id)
        'Use the DesignOption property of Element
        If element.DesignOption IsNot Nothing Then
            TaskDialog.Show("Revit", element.DesignOption.Name.ToString())
        End If
    Next
End Sub

See Also