Tag Archives: Revit

Schedule Revit and Non-BIM Data in Excel – Live

4 Feb

There is a plugin called from Ideate called Sticky that looks like it could be useful, but after watching the video I have come to the conclusion that this is an awful idea. The plugin allows you to bring “non-BIM” data in to Revit. From what I can tell, it provides a live link to an Excel spreadsheet in your Revit Project. This means you can drop the schedule on to a sheet and it will look nice – not like taking a screenshot or other workarounds. The part of this that irks me is that there is no link between the non-BIM data and the data in the linked spreadsheet. And, how much space is this link taking up in my model? I do not need my models to be any larger. Why not create a schedule with a live link between non-BIM data and data you have in a Database? Then you can PDF it and add it to any sheet you want. In my last post, I showed you how to create a view that had Revit data and data joined from another database. In this post, I will show you how to schedule them in Excel.

Get the Data

Open Excel and select the Data tab. Then choose From Other Source. You will be prompted for the database connection. As we have been using SQL Express for the previous posts, that is what I will stick with.

Other Source

When you click next, you will be able to choose the view you created in the previous post.


Click through until completed and place it at cell a1. You will then have a table in Excel of your data.


I know have non-BIM data merged with BIM data straight from Revit. It is not as pretty as the forms on the Ideate video though is it?

How to Format the Sheet

The data comes in as a single table. The rick to using this data with your existing forms and formatted documents is to link it. When you import the data, do so on a different sheet in your workbook. For example, you probably created your perfectly formatted schedule component on sheet 1, so bring the data in to sheet 2. Then you can copy and paste a link from a cell in the table to the correct cell in your schedule. Below I copied a link from cell c5 to h5. Now the data is exactly where I want it.


Hey, You Said Live?

The data may not be live at the moment, so let’s check on it. Select the properties of your data connection and make sure you enable background refresh, set the refresh interval and why not refresh the data whenever you open the sheet.


You can also click the Refresh All button if you don’t feel like waiting for the refresh interval.

So I have a link in cell h5 just sitting there. I will change the data in the database and see what happens. If I change the 1/2 bathroom to “converted to full bathroom” the table and the link will both update within a minute – or I can refresh all when I made the change.


We did it. Now, whenever the Revit model is exported using DBLink, our spreadsheets will all update with the correct information. We can then use Adobe for printing and adding to our Revit sheets.



View and Edit Revit Models in a Website with No Coding

3 Feb
Front page of my application. Bottom left box has links for walls and rooms.

Front page of my application. Bottom left box has links for walls and rooms.

What if I told you that you can create a website that will allow you to see the data in your Revit model and also edit that data without writing a single line of code?  You can, and I am going to show you how.

The Technology

The application (web page) requires a good amount of code, but you do not need to write it. Using modern development tools, Visual Studio Express 2013 for the web, we can have the code generated for us. The technology behind this are MVC and Entity Framework. MVC is an acronym for Model – View – Controller. The Model is the data, the Revit DB in this case, the controller handles all the manipulation of data and the view is the webpage we will be looking at. Entity Framework is the object relational mapping piece of the project. It allows us to write code against an object instead of knowing what is in the Database. This is not that important for you to understand at this point, because we are not going to write any code. Just know that it sits between our Database and code and handles a lot of the dirty work.

Putting it Together

I am not going to explain all the steps in Visual Studio but will give a brief overview and show the completed application.

First, you must create your application and load the Revit DB with the tables you would like to use. Then, you create a scaffolding (the web pages) by selecting the model and controller that will handle the work. From there, you can edit the HTML to customize your application. The editing of the HTML is the closest thing to code you would need to do, but it can be as easy as editing a document. For my sample application, I loaded the Walls and Rooms tables.

When you click the link for Rooms, you see the entire table.


At the end of each row is and option to edit, delete or view details. If you select details, you will see the page in the image below.


You can edit from this page by selecting edit below.


Once you have made your edits, you can go back to the main page and see the changes.


All of these changes can now be brought back in to Revit using the DB Link addin.

I did not write a single line of code for this application to work. All the code for querying and editing the database was done by Visual Studio. I just needed to know how to put all the pieces of technology together and maybe edit the HTML to make the default template mine.


Revit REST API: More Detail

29 Jan

I have ideas in my head about why a Revit REST API is cool and what it can do. I also know that I fail to explain or show what I am thinking in the best possible way. Often, my examples are quick and dirty. I really love the Revit REST API idea and have built out a slightly more detailed example to show what can be done. The images below show a more complete site. I have sorted many of the tables by the field that makes the most sense. Remember, the data can be edited – without a Revit license I might add.  The model I used was the sampel that comes with Revit 2014.

The sample model

The sample model







Revit REST API: Building as a Service

21 Jan

I have written a few posts on Revit and Databases: Revit DB Link pluginModifying Revit Data through the Web and  Linking a Revit DB to a QR Code.  I also wrote a post on the idea of downloading a building.  As I have been doing more coding, a mashup of these posts has finally hit me. I can download a building through the web and I can do it by creating a REST API on top of a Revit model exported to a database. This post will demonstrate a simple Building API using Revit.


I am going to use a RESTish API. I use the -ish because there is no real specific for REST but rather guidelines. The way it works is you submit a get, post, delete or put request and get a JSON response. For this example I am going to hack together two endpoints: getWalls and editWalls. They will be located at http://localhost:8081/revitAPI/getWalls and http://localhost:8081/revitAPI/editWalls.


When we hit the endpoint for getWalls, we want to have all the wall information returned as JSON. In this example, I will return the id and comments only. The page returns:

[{“id”:184159,”comments”:””},{“id”:184183,”comments”:””},{“id”:184205,”comments”:”Paul-NewestNewest-Comment”},{“id”:184237,”comments”:””},{“id”:184261,”comments”:””},{“id”:184290,”comments”:””},{“id”:184337,”comments”:”My Other Wall”},{“id”:184406,”comments”:”My Wall”},{“id”:184441,”comments”:””},{“id”:184476,”comments”:””},{“id”:999999,”comments”:”999999″}]


editWalls takes two parameters: id and comment. Passing a valid wall id and a comment will result in the Revit Database being changed to reflect the new comment. If successful, the endpoint will return:


Putting it Together

Now I have two RESTish endpoints. What do we do with them? Below is a simple webpage that edits and retrieves the wall table from Revit.



Clicking get walls returns a list of walls.

Wall Schedule. Notice the Badge Displays the Number of Results.

Wall Schedule. Notice the Badge Displays the Number of Results.


The edit walls menu allows you to put text in the box and it will return the wall schedule with the value of wall 184205 changed.

Paul Comment was added

Paul Comment was added

I can then open Revit and see the changes after loading the DBLink plugin.



While this post seems similar to my post on modifying Revit data through the web, you are correct, but there is one fundamental difference – the model can now be queried. In my earlier posts, I only went one way- web to Revit. In this post, the model can talk to us and tell us what is in it – Revit to web. While I only displayed a table of results, you could query by height, area, sort, filter, or perform a whole host of operations on the results of the getWalls endpoint. Furthermore, you now have the ability to make the data public. Anyone could write a webpage analyzing your building data and if you do not allow edit capabilities, there is absolutely no risk to your model.

Note To Architects: If you designed a single front end to a Revit REST API, you would only need to change the urls to ship it to every client you have a BIM for. Write once, sell multiple times. As an architect, why stop making money when the building is complete? Why not get in on the facility management side and make money for the life of the building?

Revit and RabbitMQ: Passing Data in to Revit from Outside Applications

25 Oct


I threw together a quick website using CherryPY to pass data to Revit. The QR Code pictured below, when scanned, will pull up the website, triggering the data in it to be sent to Revit. Picture a QR Code with info on a HVAC Unit, you scan it and the data is passed to Revit for when it was installed or serviced.

Sending Data in a URL to Revit. Data can be parsed to up date parameters of object.

Sending Data in a URL to Revit. Data can be parsed to update parameters of object.

QR Code with embedded data to send to Revit.

QR Code with embedded data to send to Revit.














Modifying Revit from outside the program has been my primary interest for some time.

Initially, I was fascinated by the Revit DBLink plugin and wrote a few proof of concepts that relied on the following architecture:

Revit <—–> Database<—–>Outside Program

I have recently posted proof of concepts about sending data in to Revit from outside – skipping the database export– but used GIS as my example, arguing that because GIS and Revit use the same API language it should be possible.

I now have a working example in Revit. The architecture no longer requires a Revit DB to be exported.

Revit <——- RabbitMQ<———-Outside Program. (can be bidirectional if want it to)

I wrote a Revit Add-In that connects to a Messaging Queue and retrieves any waiting messages. Getting the message in to Revit is the hard part. Once in, we can use it to modify properties – like in the GIS example that drew points from a message.

The screenshots show the Add-In, No Messages Waiting, and a Message Coming In.

This is my proof of concept and the goal is to modify this program to allow the scanning of a QR code to send a message in to Revit and modify/add properties to an object. That architects looks like this:

Revit<—— RabbitMQ<——-WebServer <——- QR Code scanned by mobile device

The Qr Code Opens a URL with Parameters(http://somewhere.com/revit?id=123&wallheight=12

The WebServer is a CherryPy Script that reads in the parameters and passes them as a message to RabbitMQ using Pika.

The Revit Add-In gets the message and modifies the properties of the wall with ID=123

Send MMS from ArcGIS Desktop Explorer – or Revit.

2 May
MMS from a button in Desktop Explorer.

MMS from a button in Desktop Explorer.

I had an earlier post on sending an MMS from C#. I have taken it one step further and dropped this code in to ArcGIS Desktop Explorer as a button. click the button and it takes a screenshot, pops up a form and attaches the screenshot. Can send as email or as an MMS. This should work for Revit too since the SDK is C# and all the code is from Microsoft not the GIS API.


When launching a form from the buttons in GIS, threading becomes an issue. Note the use of ShowDialog().  Also, in order to caputure the screen without the form in the way, grab it before launching the form. This is how you launch a form from the button in GIS:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Windows.Forms;
using System.Drawing.Imaging;

using ESRI.ArcGISExplorer;
using ESRI.ArcGISExplorer.Application;
using ESRI.ArcGISExplorer.Mapping;
using ESRI.ArcGISExplorer.Geometry;
using ESRI.ArcGISExplorer.Data;
using ESRI.ArcGISExplorer.Threading;

namespace geomms
public class Button : ESRI.ArcGISExplorer.Application.Button

public override void OnClick()
int screenWidth = Screen.GetBounds(new System.Drawing.Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new System.Drawing.Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save(“test.jpg”, ImageFormat.Jpeg);

Form1 a = new Form1();




Here is the code to send the MMS:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
using System.Drawing.Imaging;

namespace geomms
public partial class Form1 : Form

public Form1()


private void button1_Click(object sender, EventArgs e)
String strFileName = string.Empty;
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(“embudo.cabq.gov”);
mail.From = new MailAddress(“pcrickard@cabq.gov”);
mail.Subject = subjbox.Text.ToString();
mail.Body = msgbox.Text.ToString();
strFileName = “test.jpg”;
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment(strFileName);

MessageBox.Show(“Sent Message”, “MMS by Paul”);
catch (Exception ex)


MongoDB with a slice of CherryPy: Running a Query and Displaying Results

15 Nov

As you may have noticed, I love CherryPy. Recently, I have been playing with MongoDB and pymongo. In my last post I showed how to create a shapefile from a mongoDB. In this post, I will show how to connect to mongoDB through Python using CherryPy and spitting out the results of a find() in an HTML table.

Here is what the webpage will look like:

And here is the code – I’m sure there is a cleaner way to write this instead of looping twice but i’m writing this on my lunch break and don’t have a lot of time to do more than make it run.

import cherrypy
from pymongo import Connection,GEO2D
class mongocherry(object):
def index(self):
output =[]
output.append(‘<HTML><HEAD><TITLE>QUERY MONGODB</TITLE></HEAD><BODY><h1>Query MongoDB</h1>’)
output.append(‘<table border=”1″><tr><td>ID</td><td>LAT</td><td>LONG</td></tr>’)

for x in db.places.find():

while i<len(output):

return html

index.exposed = True

cherrypy.config.update({‘server.socket_host’: ‘’,
‘server.socket_port’: 8000,


I have servers running on some ports so I needed to set a config to change the port. This site creates a front end to data that will always be current. You can make your index page a form and allow the user to select the data they want, then in another def returnResults(self, user selected data): Spit out all the HTML that is in the index now, passing ‘user selected data’ to mongoDB.

I have really enjoyed playing with mongoDB and am curious about importing Revit schedule. Not sure what I would do with it once it’s loaded. But still thinking…… Any ideas?