Autodesk.Revit.UI.EditorInteraction is a class in the Revit API that provides functionality for interacting with the Revit editor. The class allows developers to perform common editor tasks such as selecting elements, modifying properties, and activating tools in the user interface.
The EditorInteraction class contains several properties that provide access to its functionality. These properties include:
The EditorInteraction class also contains several methods that allow developers to interact with the editor. These methods include:
The following sample code demonstrates how to use the EditorInteraction class to select an element in the editor:
// Get the EditorInteraction object
EditorInteraction editorInteraction = commandData.Application.ActiveUIDocument.Document.EditorInteraction;
// Select an element
Selection selection = editorInteraction.Selection;
ElementId elementId = new ElementId(123456);
selection.SetElementIds(new List<ElementId>{elementId});
In this example, we first get an instance of the EditorInteraction class from the current Revit document. We then use the Selection property to get a reference to the current selection and call the SetElementIds method to select the element with the ID of 123456.
The Autodesk.Revit.UI.EditorInteraction class provides a powerful set of tools for interacting with the Revit editor. By using the class, developers can perform common editor tasks with ease and efficiency, improving their overall workflow and productivity.