April 3, 2020

Custom properties using Design Automation

Design Automation engines are powerful and can be used for different purposes. We have many samples to modify and write information, so this sample is about reading information that is not exposed by default on the Viewer Property panel.

One may ask why some properties are not available. The answer is simple, actually: the Model Derivative focuses on extracting information that is visible on the model, and therefore can be bounded to a dbId (on the Viewer). But we know that there is way more information in Revit, right?

For this sample let's read the Revit Compound Structure Layers for Walls. This is a crucial piece of information for estimation. Our .NET plugin will look for all Wall instances, get the material name of each layer and store in a JSON file like this:

[
   {
      "uniqueId": "5ba11dd2-e2e1-447d-bae2-2b6f4a497937",
      "layers": [
         "function": "Structural",
         "material": "Concrete",
         "width": 0.005
      ]
   }
]

The Design Automation workitem will save the JSON at a bucket (in OSS) using the URN of the model (which we know is globally unique). When we open the model on Viewer, it will look for that file, load it and override the Property Panel with the additional information. For the purpose of demonstration, the sample will run the workitem every time, but an obvious optimization would be to check if the JSON is already present. 

Last, the sample was written in .NET Core and uses SignalR to notify the web client (interface) when the workitem is done. The plugin project has a "on build" action to prepare and zip the .bundle so the webapp can deploy to Design Automation AppBundle & Activity on the first run. 

>> Get the source code here.

Some additional articles:

Related Posts