If you try to build a connector to get some Revit data to a database like MySQL, you may hit an issue where some strings that are allowed in Revit will do funny things to your SQL instructions, like this:

What to do? We need to ‘escape’ these characters during our data export or INSERT to create something that the database engine can consume. There are some exotic ways to get around this (like encode your text in base-64), but in my case I just wanted to replace the problem character with the escaped version. Ideally, we would use characters that we know will never be found in Revit Type or Family Names.

Revit does not allow these characters in most type and family names:

Looks like a backslash could work, as this is an escape character in MySQL, and it is not allowed by Revit as above.

You can do this a lot of ways in various coding languages, but an easy way is with a String Replace in Dynamo, like:

This workaround doesn’t handle every situation – like if you are pulling parameters out of Revit that contain all kind of characters, you may have to look at a more reliable text cleanup or encoding solution. But this helps with the Type and Family names at least 🙂

FM, or Facility Management, is sometimes thought of as the sixth dimension of BIM, or 6D BIM.

Mario Guttman, creator of Whitefeet tools, reposted an interesting video / case study by David Mettler showing a potential workflow from Revit into an FM scenario using MySQL:

The process:  “I exported the Revit tables out to Access using the DBlink. From Access I had to setup a ODBC export using SSH Tunneling to get the remote host to show up as a  localhost. It took a lot of time to figure out the connection issues get the data across to MySQL. Once I got the bugs work out on the ODBC connection it’s a piece of cake post the information into MySQL. I used phprunner with the SSH Tunnel to create the pages.”
Revit FM Tool | WhiteFeetTools

Nathan Miller has been working on a number of cool things for some years now.  In one recent post about Slingshot for Revit, he states “the tool will provide different means of connecting Revit (and Vasari) to relational database management systems, including MySQL. More importantly, I am interested in establishing common database schema that will allow for a more fluid workflow between Revit and external design tools like Rhino and Grasshopper. This includes sharing parameters and geometry.

He has been “prototyping some functionality via the RevitPythonShell plug-in in Vasari. Python is giving me a more fluid workflow than the usual Revit development process. Eventually, the tools will become true add-ins…”

The Proving Ground by Nathan Miller: Slingshot!… for Revit?

Image from The Proving Ground – “A point cloud in Vasari being created using a MySQL database…”