Let’s keep rolling down deeper into what it takes to make a more advanced Revit Model Checker check. In part 1, we figured out that according to the Revit database, views and view templates are the same category. Now we need to figure out how we can tell them apart.
All the Data in the Database
A lot of the data associated with elements in Revit is exposed via parameters, or reference to other elements or arrays of information. But there is definitely some information that you can’t see (Google around for the Revit element GUID if you want to learn about one).
A great way to peek under the hood is with a free add-in called the Revit Lookup. If you wanna grab the DLL and ADDIN file and copy them to the right location, go here and grab the latest versions. Once you restart Revit, you get a nice new add-in in your Add-Ins tab.
Looking Things Up with Revit Lookup
There are a lot of features in this great add-in. Most of the time, you select an element, click Snoop Current Selection… and you get a window of all the data of that element. A great way to start digging into properties that you might not normally see.
For this specific check, however, we needed to see what was different with a view and a view template. So, in our test architectural advanced sample project, I opened a view and ran Snoop Active View. Basically does the same thing as Snoop Current Selection, but for views.
What I was looking for was a property that might indicate if a view could be considered a template or not. Scrolling down to the Properties section, I saw something that felt really promising.
Turns out there is a property called IsTemplate, and for my test view it was set to False. Now I just needed to confirm that the same property is set to True in an actual template. The trick is, selecting a template and opening it up with Lookup.
Confirming the IsTemplate Property
If I go to View > View Templates > Manage View Templates, the View Templates dialog opens… but I can’t select one and then run the add-in. I need to somehow select the view template. I can’t click on it in the base Revit UI. But I do know that I can select elements by their ID with Manage > Select by ID. And every element in my model has an ID.
Now I just need to figure out a view templates. ID. Back to Revit Lookup and back to the snooped view.
First of all, I had to actually assign a view template to this view so I could track it down with the lookup. Don’t get me started on what kind of barbarian creates a printing floor plan with no view template. We will leave that for another time. Once I assigned a view template, I ran Snoop Active View and did some more scrolling. It was pretty easy to stumble on ViewTemplateId in the list. Clicking on it opens up the snoop for the view template, and in that list, I can find the Id property: 9589. (Yes, it’s also there in the first window, but I like clicking on things.)
Note that in the first dialog, the row for the view template ID is bold. In Revit lookup that means that the value refers to another element, or is an array, not a single contained value.
Now I had the element ID, I could select the view template using it. Manage > Select by ID made it very easy. I also verified in the Properties window that I had it selected because I could check its name, but more importantly, the parameters listed were all settings for a view template.
On a VERY nerdy note, I enjoy selecting elements by ID that you can’t normally select and seeing what their properties look like. It’s like seeing how the universe is put together.
Now that the view template is selected, I can run Snoop Current Selection… in Revit Lookup and confirm the IsTemplate property is set to True.
Everything checked out. So now I know I have a property called IsTemplate that is set to False for regular views and True for view templates. This is how I can refine my checkset in my model check. And that is for part 3.
Where We Could Have Saved Some Time
Those of you who are following along and are a little familiar with Revit Lookup probably see where I wasted a little time. As soon as I had the original view open and I clicked on the ViewTemplateId property, it opened the view template’s snoop window (where I highlighted the Id property), so there was no need for me to get the ID and select it and then run Snoop Current Selection… I wanted to go through those steps here for folks who may need it for other elements that are hard to select in the UI.
And also, as mentioned above, I really like looking at the properties dialog for elements that I am not supposed to look at.