Element.GetEntity Method

ElementGetEntity 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: 26.0.4.0 (26.0.4.0)
Syntax
public Entity GetEntity(
	Schema schema
)
Public Function GetEntity ( 
	schema As Schema
) As Entity
public:
Entity^ GetEntity(
	Schema^ schema
)
member GetEntity : 
        schema : Schema -> Entity 

Parameters

schema  Schema
The Schema describing the Entity.

Return Value

Entity
The returned Entity.
Exceptions
ExceptionCondition
ArgumentException Reading of Entities of this Schema is not allowed to the current add-in.
ArgumentNullException A non-optional argument was null
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.
See Also