These are two key pieces of Revit API technology that work great together like peanut butter and chocolate
To be honest, RegisterDockablePane + XAML + IExternalEventHandler don’t taste as good as a Reese’s Peanut Butter Cup. But you can use them to create a simple little modeless dialog with a button that creates new drafting views. And from here this basic sample can be a launching pad to all sorts of great Revit tools.
When you pin something there should be an option to write something in a “comments” field. If someone unpins that thing then the comment you wrote would pop up like a warning dialogue. This way they would know why the thing was pinned in the first place.
I’ve created a new free tool that uses the DocumentChanged event and an External Event to prompt the user for a reason when an object is pinned. When the object is unpinned, it shows the username and reason.
Here’s another new tool in the open-source Boost Your BIM Terrific Tools. In the CSV file, enter the existing family names and the new names that you want the families to have. Run the tool and your families are renamed.
M_RPC Beetle,Beetle Car RPC Female,Woman RPC Male,Man Photovoltaic-Panel-SolarWorld-SunModule-(235-240),Solar Panel
Please help Boost Your BIM continue to provide so many free tools and free code samples that help you make Revit better. There’s a lot of great new stuff that Boost Your BIM has coming soon – please visit to https://www.patreon.com/BoostYourBIM to help make these resources possible.
Autodesk made a bunch of changes to the Revit API for Units in 2021. Many frequently-used methods are now marked as obsolete. They still work just fine in 2021 but Autodesk will probably remove them in 2022.
For one example of how to update your code, this old sample computes the total length of all selected objects and shows the result as a formatted string. The new code, which uses the method UnitFormatUtils.Format Method (Units, ForgeTypeId, Double, Boolean) is shown below.
Revit Lookup is a great open-source tool to help you better understand the data in your Revit model. I use it every day, and even if you aren’t writing Revit API code, sometimes it is still useful to get “under the hood” and better understand the data in your Revit model.
You can download the source and build it yourself, but that is not for everyone. So I created an MSI Installer that you can use to install the Lookup tool for Revit 2019, 2020, and 2021. I also submitted some changes to make it easier to build Revit Lookup for any release of Revit. Jeremy wrote a bit about it at The Building Coder.
I built the installer with Advanced Installer, a very powerful and easy to use tool for building your own installations developed by Caphyon. The drag-and-drop interface lets you quickly select the files you want to install and where the installation should place them on the target computer.
Advanced Installer has a freeware version with plenty of capabilities for many Revit API developers. If you want to support them and get even more features there are three different licenses that you can purchase.
Revit Lookup is a great (and free) tool to learn more about what’s in your Revit models. If you want to look at source code, deal with GitHub, and learn more about it, go to https://github.com/jeremytammik/RevitLookup
This post on the Revit Ideas forum inspired a new lecture on the Boost Your BIM Revit API course at Udemy. It is a great example of how just a few lines of code (17, to be exact) can be written in just a few minutes to do something useful.
When “tab” selecting a string of lines (egress lines for example) if you select all the lines in that string it should give a value for the overall length of that sting, instead of having to select each individual line and adding the lengths together yourself. this would help with more than egress plans too.
In the Revit Ideas forum it was asked if it can be possible to access this dialog to change dimension text without having to select the dimension’s text itself. Either the text has been overridden with an invisible, empty character, a view break was used, or for some other reason it isn’t simple to select the dimension’s text. Or you want to avoid the problem of moving the dimension text by mistake when you try to click it.
Fortunately, the API gives you access to most everything in this dialog (maybe not “show label in view” and “segment dimension leader visibility”). The code is below to handle a dimension with a single segment (code for the Dialog form is not included) and it could also be enhanced to work with a multi-segment dimension if the form listed the text of each dimension segment so you could specify which segment to modify.
Is there interest in a Udemy lecture showing how to code the form? Or posting it as an app in the Autodesk store?
Document doc = this.ActiveUIDocument.Document;
UIDocument uidoc = this.ActiveUIDocument;
Dimension dim = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element, "Select dimension")) as Dimension;
if (dim.NumberOfSegments > 1)
TaskDialog.Show("Error", "Can only run when the dimension has a single segment");
string above = "";
string below = "";
string prefix = "";
string suffix = "";
string replaceWithText = "";
using (FormDimText form = new FormDimText(dim))
if (form.DialogResult == System.Windows.Forms.DialogResult.Cancel)
above = form.getAbove();
below = form.getBelow();
prefix = form.getPrefix();
suffix = form.getSuffix();
replaceWithText = form.getReplace();
using (Transaction t = new Transaction(doc, "Dim Text"))
dim.Above = above;
dim.Below = below;
if (replaceWithText == null)
dim.Prefix = prefix;
dim.Suffix = suffix;
dim.ValueOverride = replaceWithText;
Want to learn more about the Revit API for Materials? This is one of the areas where Autodesk has done a lot of great work over the past few years making much more functionality accessible to the API developer. But some of it can be tricky to figure out. So don’t waste time struggling with it, take this new course instead to quickly get up to speed.
Animate your Revit model by changing family parameters, displacement set offsets, or phases. Use it to test your family content by varying parameter values or to wow your colleagues with amazing animations. This popular tool now supports Revit 2019. You can download it from the Autodesk App Store here