From the course: Revit: Creating C# Plugins

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Selecting elements

Selecting elements

From the course: Revit: Creating C# Plugins

Start my 1-month free trial

Selecting elements

- [Narrator] Many commands in Revit start with a prompt to the user to select a single element, multiple elements, or part of a particular element such as its face. The OI document allows us to access user interface functionality including the ability to select elements in the project. So, now that we have the UI document in our command let's use that to select an element from the project. In the command we have created, let's use the UI document to retrieve a selected element from the Revit document. To do that we need to use a method called pickObject from the selection class that can be retrieved from the UI document object. This will return a reference element from the Revit API. A reference element from the Revit API is simply a stable reference to a geometric object in Revit. So, let's create a reference variable named PickObj and we'll do this after we've retrieved the UI document. We can then assign to this the result of the pickObject method. To access this, let's access the…

Contents