Archive | BIM RSS feed for this section

Data and Design

8 May

If you have read any of the posts on this blog, you should know I love data. But what you may not know is that I love architecture, design and a good sketch. I spent five hours getting Study For The War Coffer by Eugene Delacroix tattooed on my chest.


Often these two worlds collide. I came across a tweet today:

Mindlessly drawing with data? How dare she. I once thought it a good idea to write computer code that could read an architectural program and develop the floor plan automatically. While I still favor some of this thinking, I have had to think it through. And slowly I have come out against it, and I have sided with Tara on this issue.

There is something to be said for hand drawing. The lines made by a pen, with their varying weights, show movement in a still image. There is something beautiful about them. About the process of sketching. Freely moving your hand across the canvas. The AIA had a podcast on Didactic Drawing that really brought it all home for me. On a computer, scale can change. You can draw a hundred foot line and based on your zoom level (scale) it could be a millimeter long. On paper, your scale is fixed. The movement of your hand across the page lets you know how long the line is.

I am not against BIM. But without pre-sketching designs, these program make it easy to create boxes, squares and overall bland buildings, to draw without a set scale, to fully understand and feel the building you are creating.  To design with data is an idea I am still deeply attached to. But I think we walk a fine line between letting data inform design- on how people use buildings for example – to creating the design for us – as in my program example earlier.

Applications like Revit or Grasshopper make it east to start with a simple form – a box – and twist, pull, rotate and skew it to come up with a whole host of possible forms. The results are soulless – though some look really cool. I do not see the art in it. If we are just going to feed some data in to a model to generate a form and say “look at this cool form I created from using the coordinates of all tweets that had the word Gehry in it” then we might as well give up – though I find these kinds of experiments interesting.

Data is, of course, valuable for facility maintenance. I also find value in data on movements of individuals within buildings and with modeling designs for things like airflow, heat, sunlight, etc. These are the kinds of data that can inform design – or confirm that a specific design is a functional design.

I do not want to live in a City full of bland buildings, just as much as I do not want to live in a world full of monuments to the architect that are outrageously out of context. There needs to exist a balance of the art and the science, of architecture and data. And each needs to compliment the other.



View and Edit Revit Models: Add a Filter Using Code

17 Feb

I have recently shown you how to view and edit Revit models on the web without writing any code. I have also shown you how to filter the views using a very little SQL in your database. In this post, I will show you how, in a few lines of code, you can create a search box to filter the results in your pages.

Application Layout

In an MVC application, you have a model, controllers and views. As explained in an earlier post, The model holds the data from the table or tables selected. The controller sits between the model and view performing actions and responding to events which are sent to the model or passed to the view. The view is what you actually see when you load the page. the image below shows the layout of a simple Revit MVC Application.


I have a Revit mode, controllers for Rooms and Walls and views for the Rooms and Walls. There are separate views for each of the CRUD functions. There are other views, models and controllers that are created by .NET by default. Feel free to ignore these at the moment because we will not be using them.

To add filtering to our application, we will need to modify the Rooms View and Controller.

Rooms View

There are several views in the Rooms folder, but for our application we want to modify Index.cshtml. This is the view that returns the entire model – list of rooms in our database.  You can see in the code that the view creates a table with all the properties for each room in our model.


We want to limit the number of items in the Model returned from the controller using a search box. Let’s add the search box to the view. As in standard HTML, we can use a textbox and a button in a form. With MVC, however, we are using the Razor view engine so the code is slightly different.

@using (Html.BeginForm())
Find by name: @Html.TextBox(“SearchString”)
<input type=”submit” value=”Search” />

The code above should make sense if you are familiar with HTML. The only thing that stands out are the lines starting with the @ symbol. These are variables/expressions in Razor. The above code will create our search box.


Rooms Controller

Now that we have the form, we need to create the code in the controller that will handle the request. The first ActionResult in the code is the Get Rooms function. This is the code that returns the Index.html file we see in the view. The code below will make our search box work.

public ActionResult Index(string searchString)
var rooms = from r in db.Rooms
select r;
if (!String.IsNullOrEmpty(searchString))
rooms = rooms.Where(r => r.Name.Contains(searchString));

return View(rooms.ToList());

when we browse to the Index.html page for the first time, we will see all the rooms in the database. This is because the string searchString is empty. So rooms is equal to the contents of the entire database.

var rooms = from r in db.Rooms
select r;

Once on the page and having entered a value and clicked search, we have requested the Index.html page again, but this time with a value for searchString. Now the controller populates the value of rooms with only those records where the string is in the name.

rooms = rooms.Where(r => r.Name.Contains(searchString));

The function always ends by returning the View (the one with the same name as the controller) and passes it the values of our rooms variable – either all of them or a filtered list.

the images below show rooms filter by the word Master and even by just two letters. The code above uses Name.Contains not Name.Equals. this allows us to get results without exact matches.



This little bit of code has greatly improved our application. The code can be modified to search on additional fields and added to other views – like the Walls Index.cshtml view.


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.


Join External Table to Revit Database

4 Feb

In my last post, I showed how to filter a table by creating a view and bringing that view in to your MVC Application. You can also join tables. In this post, I will show how to join Revit data to an external Database.

The Database

I export my Revit model to a database called RevitSample. While it appears that I can add additional tables and Revit will not overwrite them, it is probably best to stay out of the tables in the Revit Database. To avoid corruption of my Revit DB, I will create another database called AdditionalData. I will also add a table called MoreData. Below is an image of the Databases and the Table.



I now have a table that has room numbers which coincide with the numbers in my Revit Rooms table. Any data in this table can be joined to the Revit table using number as the join field. to create the join, I add a new view and enter the sql shown in the image below.


MVC Application

The additional data has been added to the Revit View. I can now create an MVC application and load my view as the model. When I am done, I will have a table like the one in the image below.


While you can view this table, because there is no primary key in the view, you cannot edit. There appear to be workarounds, but while I can make the errors go away, the save function does not work. This is acceptable as editing should take place in the correct table, not a view.


why would you want to do this? I spent many hours typing data in to Revit because we needed it in a Report and we could get it from the schedule. Being able to join the data, I can load the outside data in to a table and join it. Then I can export it to my application and it is in a schedule or report. The Revit model remain untouched and my outside data can change and if it gets corrupted, my model is safe. As long as I do not need the data in Revit to generate plans, why not attach it later. I can still query it as if it is in the same table and generate all my reports and schedules. Revit doesn’t exactly create pretty schedules for reporting purposes, so why not use the Database to do it for you using something like Crystal Reports?


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?