Modify Revit Model Data Through the Web

10 Jan

In my post on Programming for Architects I mention how I can use PHP to edit Revit model data.  In this post, I will briefly explain how this is done and point you to a very simple website demonstrating the results.

1) Export your Revit model to a datababse using RevitDBLink. If you don’t care about bringing the results back in you can export a single schedule to CSV and create a database table from that, or export the whole model any way you wish.

2) Download a WAMP stack. WAMP stands for Windows, Apache, MySQL and PHP. You can get the entire stack here:  WAMP Server.

3) Create a webpage in the WWW directory that has a form and whatever else you want to display. The form should call a PHP file. Mine calls insert.php to change the values and a popup.php file to display data. Name the HTML file index.html.

4) Create a PHP file that updates the database.  This is where you need to be able to code, or at least copy and modify code from the web.

5) Start Apache and browse to http://localhost/           to see it in action.

I have a very simple example running on my website. Click on a room to see the current properties. Change the values and click submit. Reclick on a room to see the changes. Currently, this edits the database in real time but requires a user to open Revit and bring the database back in. I see this as a good thing because it adds a layer of protection. It allows the user to import a specific table (rooms) and preview the changes prior to importing.

Happy Hacking.

Advertisements

10 Responses to “Modify Revit Model Data Through the Web”

  1. Nicklas February 10, 2012 at 8:22 am #

    How did my get revit to export to mySQL??? Revit db link don’1 seem to word with mysql…

    • paulcrickard February 10, 2012 at 2:14 pm #

      I have tried different drivers and have not got it to work. Access and MS SQL Server seem to work well. My web example uses MySQL because I exported out a schedule and pulled it in to the database through PHPmyAdmin. I can then pull that table back through a local copy of Access and then to Revit.

      • Eric March 20, 2012 at 2:55 pm #

        I have been able to export to MySQL through the Revit menu>Export>ODBC however this is a one way operation it would seem.

      • paulcrickard March 20, 2012 at 3:23 pm #

        It’s one way but can make it two if will to jump through some hoops. I used RevitDB link and exported to MS Access, then exported out the table I want – walls- imported it in to MySQL and when changes made, I ran it back through Access using an update then back to Revit via DB Link again. If my hosting company had MS SQL I wouldn’t have to do this.

      • Eric March 20, 2012 at 3:42 pm #

        Yeah it seems that only MS-SQL plays nice with RDB Link right now. I am using MySQL since dreamweaver doesn’t play nice with MS-SQL so I am stuck between a rock and a hard place. I am sure I could get MSSQL working with dreamweaver but that is above my level of knowledge. I have really been enjoying reading your blog today, tons of interesting stuff! I had one other question about when I have exported from Revit to MySQL I am getting a lot of weird rounding on area’s and some strange values on levels as well. Has this been your experience too? Here is an example: http://turissystems.com/vpr/findorff/all.php

      • paulcrickard March 20, 2012 at 4:26 pm #

        Oh yeah! I get those rounding problems too – even when I just spit out a schedule to Excel. On the areas, I think when you don’t use decimals Revit rounds for display. I have never had an error greater than 2sqft. As for the levels, I think Revit must be using some numeric ID instead of the text name you assign. Doesnt seem to be a big deal – more of an annoyance – but you could map the text name to the ID.Glad you like the blog. Thanks for commenting.

  2. Eric March 20, 2012 at 9:23 pm #

    Paul, would you be willing to share you process for getting your data out of MySQL via PHPmyAdmin and back into Revit? I am having a hard time determining how to export the data, if its CSV or Excel etc… Feel free to email me at eschappe (at) turissystems (dot) com

    Thanks much!

Trackbacks/Pingbacks

  1. Revit Editor iPhone App « Architecture and Planning - March 14, 2012

    […] a previous post I showed how to Edit Revit Data Through the Web using Apache, PHP, and MySQL. The webpage ran on mobile devices, but I have thrown together an […]

  2. Revit REST API: Building as a Service | Architecture and Planning - January 21, 2015

    […] have written a few posts on Revit and Databases: Revit DB Link plugin, Modifying 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 […]

  3. Revit REST API: Building as a Service « ExploreAbout.com - January 21, 2015

    […] have written a few posts on Revit and Databases: Revit DB Link plugin, Modifying 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 […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: