Revit View Type Creation using Excel with Dynamo and Python

SHARE
Share on email
Share on linkedin
Share on facebook
Share on whatsapp

One of the tasks a BIM manager has is to manage view creation at the beginning of a project. I believe this task is most challenging on the Mechanical Electrical and Plumbing side. Consider the following multi-disciplinary project view structure.

Micrographics, Autodesk, Revit, Dynamo, Python, Excel, ViewFamilyTypes, View, Family, Types, Create, Duplicate

Clearly, there is multiple floor plan view types and these need to be created for each level (think skyscraper). Doing this manually is a chore. Clearly for a BIM consultant wanting to set up templates for multiple companies in rapid response to an Employers Information Requirement (EIR) is crucial. Well, that is why we have Dynamo and Python, isn’t it?

What happens when one is subject to a Lead Designer who does not specify the same discipline codes for the project as what one has in one’s template. Is one now required to change floor plan view type names manually? I figured not, so I started investigating the automation thereof using Dynamo and Python. Clearly, the Revit API is needed.

In the image below, the FamilyViewType class does not expose a “Create” method, but there does exist a “Duplicate” method. In other words, even though the object does expose types, one is not allowed to create them, but only duplicate.

Micrographics, Autodesk, Revit, Dynamo, Python, Excel, ViewFamilyTypes, View, Family, Types, Create, Duplicate

The following thread on the net discusses this topic:

Using Dynamo nodes, one may expose the FamilyViewTypes within the template (just make sure they are present – I had to create the Gross and Rentable Area plans within the base template to get at them all) as follows:

Micrographics, Autodesk, Revit, Dynamo, Python, Excel, ViewFamilyTypes, View, Family, Types, Create, Duplicate

In Python this can be done in code:

Micrographics, Autodesk, Revit, Dynamo, Python, Excel, ViewFamilyTypes, View, Family, Types, Create, Duplicate

One may output to a text file in order to copy and paste the values into Excel spreadsheets without human error.

Micrographics, Autodesk, Revit, Dynamo, Python, Excel, ViewFamilyTypes, View, Family, Types, Create, Duplicate

These are the “base” ViewFamilyTypes in Revit

Micrographics, Autodesk, Revit, Dynamo, Python, Excel, ViewFamilyTypes, View, Family, Types, Create, Duplicate

Here I include the “base” ViewFamilyTypes in an excel spreadsheet for the creation of Floor Plan View Types.

Micrographics, Autodesk, Revit, Dynamo, Python, Excel, ViewFamilyTypes, View, Family, Types, Create, Duplicate

These are then duplicated as required:

Micrographics, Autodesk, Revit, Dynamo, Python, Excel, ViewFamilyTypes, View, Family, Types, Create, Duplicate

Clearly, some error trapping still needs to be done, but the Python script works well enough for myself, as I understand how to use it in conjunction with my spreadsheet.

In the following weeks, I am going to delve deeper into creating custom templates using an Excel Spreadsheet, Dynamo and Python. Happy Coding!

RECENT ARTICLES