GetEntity Method


Returns the existing entity corresponding to the Schema if it has been saved in the Element, or an invalid entity otherwise.

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

Syntax

C#
public Entity GetEntity(
	Schema schema
)
Visual Basic
Public Function GetEntity ( _
	schema As Schema _
) As Entity
Visual C++
public:
Entity^ GetEntity(
	Schema^ schema
)

Parameters

schema
Type: Autodesk.Revit.DB.ExtensibleStorage Schema
The Schema describing the Entity.

Return Value

The returned Entity.

Remarks

The Entity that is returned is a copy of the stored data (with copy-on-write optimization). Modifying it is allowed (even with restricted write), but to save your changes you must call SetEntity.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException Reading of Entities of this Schema is not allowed to the current add-in.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null

See Also