From the course: Revit: Creating C# Plugins

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Modifying elements

Modifying elements

- [Narrator] We now have a command in our project file that has started a transaction. Let's use this to modify the document by learning how to delete an element. To start, in the object browser, let's search for delete. Perfect, so it looks like the first method is the delete method from the document class. If you can't see this, make sure the settings of the browser includes show inherited members. This method simply takes an element ID, which is the element to be deleted. So let's use this in our command. And we'll do this after the transaction has started. To access the delete method let's access the document, and here we can find delete. Then for the element ID, we can retrieve this from the selected element as we have done in previous videos. By accessing the element ID property from the picked object. Perfect. So the element will delete, but not until the transaction has been committed. To ensure the user is confident they want to delete the method, let's create a task dialogue…

Contents