Menu

Tweet To Revit (via Dynamo)

By Microsol Resources | BIM

helloworld

Dynamo is to Architects & Designers what Scratch is to toddler geniuses learning to code. It gets us thinking in terms of manipulating the machine using instruction sets rather than punching individual commands at the computer all day. More importantly, it is a platform designed to span between the world of coding and world of assembling architecture. This by definition, makes Dynamo extensible in both directions and a whole lot of fun.

The Case for a Project Twitter

Personally, I’m not a tweeter (sic). However, after a recent natural disaster, it (Twitter) was the only source of information about a particular neighborhood I wanted to track. A typical architectural project is not a place where random strangers gather for a round of kumbaya. Even so, a platform such as Twitter certainly breaks barriers in sharing thoughts, ideas, and solutions within a team. It could be anything from a gentle reminder, a recently discovered piece of project information, or , live tweeting of meeting notes. With Dynamo’s Iron Python Interface and ability to add *.dll libraries, along with Twitter’s well-documented Application Programming Interface (API), the rationale for building a connection between Twitter and Revit quickly went from ‘is there a need?’ to ‘why not?’ and ‘because we can!’.

The Process

 

As of the writing of this post, Dynamo does not have a package to retrieve Twitter Timelines (although one exists for publishing tweets – ‘DYN Tweet’ Package). The PYTHON programming language on the other hand has plenty of easy-to-use libraries to run circles around the Twitter API ‘It would be a one-day fun project’ I thought. It was… until I discovered that I could not get the beloved Tweepy Python Library to work with Iron Python – the version of Python that Dynamo implements. I spent three days scouring  Google and attempting all sorts of ‘pip’ installs – but to no avail. Finally, I gave up and went to my go-to code kitchen: C#. I recently discovered that Dynamo had a ‘Zero-Touch’ plug-in environment that lets one import *.dll libraries and leverage the awesomeness (and some pain) of the .NET programming multiverse. After finding a sufficiently simple library (Tweetinvi), I set to wrap the example functions to make *.dlls that can work seamlessly with Dynamo.

00. Getting Started:

If you would like to try this on your own, you will need to import the Dynamo Twitter Connector. Unfortunately, I don’t have this as a published package, but you are welcome to use the one available in the Debug folder of its Git Hub repository. Even better, you can download and build directly from the GitHub Source (and hopefully add new features). You can then import the library via the ‘File>Import Library’ menu to have the package show up in the Dynamo tool palette.

00_toolpalette

01. Authentication

In order to connect to Twitter, Twitter needs to know who you are. Basically this involves creating an ‘App’ via the Twitter account. You can do so by going to https://apps.twitter.com/ and signing in with your twitter credentials. After this, we can create four keys: the consumer key, consumer secret, access token, and the access token secret.

01_appauthentication

02. Retrieving Time Lines

Once you are authenticated, the rest is relatively simple. All that is left to do is to hook-up your Dynamo Nodes to retrieve and  convert tweets in your time line to a string that will be displayed in a Revit View.

02_timelineasstring

03a. Displaying Time Lines

This step involves setting up a ‘Text’ parameter in a Generic Annotation Family and hooking it up to the output of the previous set. Strangely, I found that it is not easy to select annotation families in Dynamo (unless I’m missing something very obvious).

03a_updateannotationparameter

03b. Tweeting from Revit

Tweeting from the Revit Project is a breeze with the ‘Publish Tweet’ node.

03b_publishtweet

 

INDUSTRIES:

Published on April 5, 2016 in BIM.

About the Author

Microsol Resources delivers integrated solutions that help customers design, simulate and analyze their ideas, increase operational efficiencies, and maximize their return on investment in their technology solutions. As a team, we are passionate about helping customers improve their productivity and overall business processes. How can we help? Just reach out.

BACK TO TECH RESOURCES