All posts by Jay Merlan

BIMxHTML – A Dynamo Package to Generate Web Pages

All of the excitement revolving around generating dashboards using Power BI made me wonder: Can we leverage Dynamo to create web pages that display data directly from a Revit model? The goal would be to create a powerful, free alternative to generating web-based content using simple HTML code.

Needless to say, the gears have been turning and I have been experimenting. With that said, I have published my first Dynamo package, BIMxHTML, which will eventually have several nodes to display content on a web page using very basic HTML. I have been playing with Twitter Bootstrap and Google Charts so far.

Update: New nodes have been published to v0.0.8 which streamline the creation of Google Charts. Read up on the nodes here:
http://bimextension.com/bimxhtml-v0-0-8-more-custom-nodes-to-generate-google-charts/

For now a single node is included in the BIMxHTML package: Generate Web Page.

Using Dynamo node to create a static HTML web page.

The inputs for Generate Web Page contain several default values for configuring the <head> of the web page. I have also included inputs to allow users to link to external CSS stylesheets and JavaScript files or embedded code for custom <style> or <script> tags. All without managing the template’s HTML directly.

I have a sample model and graph for you to see the node in action available for download below.

Use Dynamo to generate a static HTML web page.
Sample Dynamo graph using BIMxHTML nodes to create an HTML web page.

Sample Files Explained

There are a few sample graphs included in the download below. Please keep in mind that these are extremely early examples of the possibilities of using Dynamo to extract Revit data and output HTML for display in any modern browser. Currently, I have been experimenting with a combination of Twitter Bootstrap and Google Charts, but if you have any suggestions on other frameworks or analytics tools, please make a suggestion in the comments below.

Table Sample.dyn (TableTest.html)

Creates a list with parameter values as sublists.

  1. Using Python, the HTML code for a table is generated using each list item as a table row and each sublist item as a column value. Note: a custom node will be added to this package to handle this in the near future.
  2. Finally, the Generate Web Page node from the BIMxHTML package creates the entire web page’s code and then writes the code to an external HTML file.

Google Charts – Pie Chart.dyn (Air Terminals.html / Ducts.html)

Creates an HTML page containing a Google Charts pie chart displaying the quantity of family types per category.

Dashboard.html

A sample Bootstrap layout which uses iframes to display the pie charts generated from Google Charts – Pie Chart.dyn.

Use Dynamo and Revit to create a free alternative to Power BI
A dashboard generated using Dynamo, Revit, Twitter Bootstrap, and Google Charts.

Feedback?

Would these tools help you with your workflows? Do you have any suggestions on how I can improve on these? Would you like to help contribute? Please leave your questions and comments below.

BIMxHTML-Sample-Files-1.zip (85 downloads)

Hello Dynamo World!

In learning every new programming language, it is customary to start with a “Hello world!” application. Although visual, Dynamo is a scripting tool as well, so I thought this would be a great first step for folks who are new to Dynamo.

In this post, we demonstrate how to display “Hello world!”  in the Revit application in two ways:

  1. Displaying a TaskDialog in Revit using a combination of Dynamo and Python.
  2. Adding a TextNote to a view using only out-of-the-box (OOTB) nodes.

Hello World Using Dynamo and Python

Hello world Dynamo graph

The image above shows the completed graph (download below). Most of the work is done within the Python script which uses two inputs as variables.

Insert a Python Script node.

Once the node is placed in your graph, you will need to click the “+” button to add an additional input.

Python script node in Dynamo to show a task dialog in Revit.

After adding the second input, you should see IN[1] as shown below.

Python script in Dynamo to show a task dialog in Revit.

Add strings to your input.

For this example, I’ve shown two different nodes that you can use to output strings in Dynamo. The String node outputs a string from the value that you insert into the node (Hello). The Code Block node must include double quotes and a semicolon to output a string (“Hello world!”;).

In computer programming, a string data type is a set of characters. This can be in the form of a sentence or a file path, and can contain special characters and/or spaces. Strings are typically enclosed using double quotes.

Connect the nodes to the inputs as shown below.

Hello world Dynamo graph

Insert code to the Python Script node.

To open the code editor in Dynamo, double-click on the blank area of the node as highlighted below.

Edit a python script in Dynamo

Insert the code below to the code editor. Note that we are including the Autodesk.Revit.UI namespace in order to use the TaskDialog.Show() method from the Revit API.

I highly recommend that you type this code in rather than copy/pasting. It will help you start to understand Python’s syntax.

import clr
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import TaskDialog

windowTitle = IN[0]
windowMessage = IN[1]

messageDialog = TaskDialog
OUT = messageDialog.Show(windowTitle, windowMessage)

If your Dyn is set to run automatically (it is by default)  you should immediately see the dialog box pop up in Revit. If set to manual, click the Run button in the bottom left of Dynamo to run the script.

Here is a link to the Dynamo graph used in this example:
HelloWorld.dyn (58 downloads)

Hello World with OOTB Nodes

Dynamo BIM - Hello World in Revit

The image above is the completed graph (download below) and will create a TextNote in the Revit view of your choice.

1) TextNote.ByLocation
This node does all of the work. It will place a text element in the view that you choose. The node has several inputs, but for this example we will only use the first four inputs.

2) Views
A node that provides a drop down menu of all of the views in your project. Choose a floor plan view in your active model as you follow this example.

3) Point.ByCoordinates
This node outputs a Point based the x, y, z inputs. For this example, I’ve shown three different nodes that you can use to generate number values: 4) Number , 5) Code Block, and 6)Number Slider

7) String
The value in the String node goes into the “text” input for the content of the text note element in the Revit view.

8) String
The value in this String node goes into the “alignment input”

Here is a link to the Dynamo graph used in this example:
Hello World - Text (75 downloads)

Questions? Post your comments below!

Linked Mechanical IFC Model Into Revit; Can’t See Ductwork

Tonight (yes, I am working on a Friday night), I ran into a new issue that I thought the community might be interested in. I linked an IFC into Revit which was exported from AutoCAD MEP.

The issue is, I could not see any of the duct.

Autodesk posted a solution to the problem that unfortunately did not work for me. After a little experimenting, I discovered that if you switch to a reflected ceiling plan view, the duct work from the IFC was visible in my view.

Hope this helps somebody someday!

Faro Scans and Autodesk ReCap

Just a quick post to share that I had a first crack at using Autodesk ReCap 360 for importing laser scans from Faro to reference as-built conditions. So far, Recap is working well for importing FLS scans.

Faro laser scan in Autodesk ReCap
Here is an image of a massive utility tunnel that I’m currently working on. More to come!
Faro laser scan RealView in Autodesk ReCap
ReCap is also is able to reference the “Real View” photographs included in the Faro FLS files. Navigating in the fashion is similar to Street View in Google Maps. Very cool.

Managing View Templates with Revit links that are set to “By Linked View” per level

One of the biggest challenges of dealing with large Revit models is working with outside consultants’ linked Revit models. You may need to use a linked view to easily match said consultant’s floor plan views. In that case, you should use the By Linked View V/G setting of your RVT Link. The problem you will face is that you cannot control the linked view with a View Template unless you have a View Template for each level.

I’ve seen a number of projects that actually had a view template per level. Don’t do this! In my opinion, this is improper usage of templates because if you have to make a change to a template, you would actually have to do it several times (once per floor). Keep in mind that for large Revit projects, the less templates you have, the better.

So, how would you solve the issue of having linked models with their Visibility/Graphics set to “By Linked View” on multiple levels without managing a template per floor?

First of all, in your View Template settings, uncheck the V/G Overrides RVT Links.

You cannot use this setting if you have linked views that point to specific levels unless you have a view template for each linked level.

View template settings for levels that use By Linked View in Revit.

Second, create a view template that ONLY controls the V/G Overrides RVT Links.

Think about how you would like to apply the linked views in batch and set your linked view in that template. For this example, I needed to create a template per level.

I realize I seemingly contradicted myself by having a template per level, but keep in mind that these templates are never assigned to views themselves – we will use them to apply the RVT Links settings only. So in the rare event that you need to changed your By Linked View settings, you are still saving an enormous amount of time by using these templates to manage your “backgrounds”.

Using Revit View Templates to manage linked models with V/G set to By Linked View.

Managing view templates when you need to use a linked view from a linked Revit model

 

Lastly, apply the template properties to all views that need to display the linked view in your template.

Select the multiple views that you need to have the same linked background (most likely every view per level) and right click and select Apply Template Properties from the menu. Note that applying a template’s properties to a view does not assign the template to that view. It will only apply the properties that aren’t controlled by the assigned template.

Apply view template properties to all views in Revit.

Power-user tip: Change your Project Browser organization to group the views by Associate Level so that you can easily select all views for each level easily.

Revit tip to group all views by level to easily apply view template per view for linked views.

[Solved] Revit Error: Unable to make the necessary Workset (Project Info) editable in the Linked File in order to change the Shared Coordinates.

While attempting to link an architectural Revit model into my electrical model, an interesting error message popped up:

“Unable to make the necessary Workset (Project Info) editable in the Linked File in order to change the Shared Coordinates.”

Revit Error: Unable to make the necessary Workset (Project Info) editable in the Linked File in order to change the Shared Coordinates.

This was a new one for me.

When attempting to open these models, you can’t uncheck the “Detach from Central” box, nor can you tick the “Create New Local” box.

Revit - Can't click the checkbox to detach from central or create new local.

This gave me the clue that the architectural model was a detached central model. This means that the model has been detached during an eTransmit process.

It is hard to find technical information regarding the state of these models. From what I’ve figured out, the model is in a state where it is technically “read only”. So if the linking process requires accessing or revising anything in the linked model, you will get an error. In this case it was an issue with permissions to edit shared coordinates.

The Solution

Save the linked model as a central model.

[Solved] Revit does not display vertical elbows (i.e., risers in shafts) properly in plan view

Let’s talk a little about Plan Regions in Revit. In a nutshell, this tool helps to show areas of a View that may need to deviate from your view’s View Range. Aside from the common uses for this in architecture, mechanical designers can actually get their risers to display properly when using a vertical elbows.

The Problem

Mechanical and plumbing Revit Designers have undoubtedly run into issues with their ducts that turn vertically if the elbow is outside of the view’s View Range. Revit does not cut through the elbow properly, if it cuts through it at all. Note the image below is missing the “X” within the riser to graphically designate which system the duct is on.

Revit duct elbow is not cut in plan view
A duct turning down in a shaft that is not cut properly.

The issue is caused by the View Range settings for your view. Don’t fuss with the View Range settings for the entire View because tweaking View Range for one riser can be catastrophic for your the rest of the elements on your View.

2016-10-05-10_23_49-view-range
View Range settings that do not cut the duct properly.

The Solution: Use a Plan Region

The steps below outline a simple workflow to fix this issue. The goal is to create a Plan Region that encompasses the shaft’s view range requirements. Note that this technique also works with pipe elbows that do not graphically show the proper up or down symbol.

First, take note of the elevations that you need where you need to adjust your view range for the Plan Region.

2016-10-05-10_23_33-section_-section-1-project1
Section view of duct turning down in a shaft with dimensions.

Next, go to View > Plan Region and draw a shape around the area you would like the View Range to effect.

2016-10-05-10_24_07-autodesk-revit-2016-floor-plan_-1-mech-duct-project1

2016-10-05-10_24_29-autodesk-revit-2016-floor-plan_-1-mech-duct-project1
Use the Draw tools in the contextual tab.

Important: Your plan region needs to encompass the entire riser for this to work. If the outline of your Plan Region overlaps the duct, it will not be effected.

You may want to extend your Plan Region a little further out than the duct itself. Note that the Plan Region outlines do not print.

2016-10-05-10_24_50-floor-plan_-1-mech-duct-project1
The completed Plan Region.

Now we must adjust the View Range for the Plan Region. With the outline of the Plan Region selected, go to the View Range setting in the Properties window.

Adjust your View Range accordingly based on your measurements from step one.

2016-10-05-10_25_14-view-range
View Range settings for the Plan Region of the shaft.

The riser should now display the appropriate symbology within the duct that is turning up or down.

2016-10-05-10_25_23-floor-plan_-1-mech-duct-project1
A proud supply air duct riser displaying it’s “X”!

Use Dynamo to delete all views in Revit

I have been working on a Dynamo Workflow that will purge out all views and sheets from a Revit model. Yes, there are several add-ins that currently accomplish this task, however I eventually want to create a “Super Purge” Workflow that will purge a model of all views, sheets, and elements for me. More on that to come.

Requirements:

  • Clockwork
  • Springs
  • Dynamo

The Workflow

Use Dynamo to delete all views in Revit.

The SetDifference node is grabbing all views in the current document from the Document.Views node and removes the  user-specified view to keep in the model from the Views node. Note that Revit maintains the requirement to have at least one view within a project.

Then, the Springs.Doc.DeleteElements node deletes all views (except for the one chosen in step one).

Download

Dynamo - Delete all Views (326 downloads)

Special Thanks

A special thanks goes out to the good folks at DynamoBIM.com for helping me out with this solution.