Comparing View Templates in Dynamo

Comparing View Templates in Dynamo

Archi-lab has been working with HCM and Jordan Billingsley on a little Dynamo Script for comparing View Templates in Revit. The idea was to identify which View Templates could be discarded because they eerily resembled some other View Templates already loaded into the project. You know, that Sheet, that has 5 drawings on it, all Detail Elevations, all with a different View Template.

Since we needed a few extra nodes developed for this purpose, we agreed to share them with a wider Open Source community, while I would charge a discounted rate to be able to publish them via archi-lab.net. It sounded like a win-win, so we went ahead with the idea. Here’s a snapshot of some of the comparison methods that we were able to do.

The whole thing is a bit large to put in a single post, and describe so Archi-lab will only discuss View Filters, but you should be able to get the idea of what we are doing here.

image © archi-lab

image © archi-lab

First we are collecting all View Templates in the file. To make that easy we are using custom nodes from Archi-lab.net, that allow for visual selections via simple check box menus. After that, collect all View Filters for the selected Templates and sort them by their ID. The reason we do that is to make sure that further down the line when we are comparing features of these two View Templates, we are always comparing two lists with Filters in the same order in the list. They should be arranged by their Ids anyways, but just to be safe.

image © archi-lab

image © archi-lab

Next is the actual comparison routine. First you want to know if the two View Templates have the same Filters applied. So we use a node Views.IsFilterApplied, we use that boolean to filter the list of View Filters, and then compute a difference between the two lists of applied Filters. The idea is that if the two lists are exactly the same, then my two View Templates have the same Filters applied. If they do, then we would proceed on to a detailed comparison check, if they don’t then there is no reason to waste computational time. At this point you know that your View Templates differ at applied Filters.

image © archi-lab

image © archi-lab

We use the single boolean value from this portion of the script to control two Boolean Gate nodes. What is a Boolean Gate? Archi-lab borrowed the concept from Grasshopper. This node passes a supplied value through, only if the “pass” input is set to true, otherwise it passes out a null. That way, our comparison would terminate here. In this case, we have a true, so we want to go on, pass the View Templates, and Filters, to obtain their Override Graphics Settings.

image © archi-lab

image © archi-lab

This little list management routine allows us to compare each setting of the override for both of the View Templates. We are basically asking the question: Is Color set for Projection Line the same for both View Templates. We can answer these questions by inspecting the report:

image © archi-lab

image © archi-lab

Or we can filter the report itself, and show only Override Settings that differ between the two View Templates.

image © archi-lab

image © archi-lab

Obviously, in order to truly compare View Templates, we would do a lot more than just compare Filters, but like we said, it would be way too long of a post. So far we were able to compare a few more things:

  • Compare if templates have the same include parameters checked. Basically answers the question: Do both of these View Templates control overrides for Model Categories, Annotation Categories, Scale etc.

  • Phase Filter, Detail Level, Parts Visibility, Discipline, Show Hidden Lines, View Scale, View Name, View Type

  • View Filters

  • Model Categories Overrides

  • Annotation Categories Overrides

  • Analytical Categories Overrides

We haven’t had a chance to look at:

  • Import Overrides – not available in the API

  • Model Display Settings

  • Shadows

  • Sketchy Lines

  • Photographic Exposure

  • Background

  • Rendering Settings

With the exception of the Links/Imports not being exposed in the API, I think we can actually compare most of the other stuff. We just didn’t get around to this yet. Let that be food for the thought, and some work for the future.

You will need the latest version of Archi-lab.net for this


This article was originally published on Archi-lab’s blog and has been republished here with permission.

cover image © unsplash

Brighten Your Design: Tips to Energize Your Home in Time for Spring Cleaning

Brighten Your Design: Tips to Energize Your Home in Time for Spring Cleaning

Post-Pandemic Cities Can Permanently Reclaim Public Spaces as Gathering Places

Post-Pandemic Cities Can Permanently Reclaim Public Spaces as Gathering Places