FireRatingCloud is a C# .NET Revit add-in.
It is a multi-project re-implementation of the FireRating SDK sample.
It uses a REST API to access a cloud-based database managed by the fireratingdb node.js MongoDB web server.
This repo also includes two other projects:
- FireRatingClient, a stand-alone Windows forms executable implementing a read-write fireratingdb client that you can use to remotely edit the BIM without entering or even installing Revit.
- FireRating, a shared library used by both FireRatingClient and FireRatingCloud.
FireRatingCloud is a member of the suite of samples connecting the desktop and the cloud.
Each of the samples consists of a C# .NET Revit API desktop add-in and a web server:
- RoomEditorApp and the roomeditdb CouchDB database and web server demonstrating real-time round-trip graphical editing of furniture family instance location and rotation plus textual editing of element properties in a simplified 2D representation of the 3D BIM.
- FireRatingCloud and the fireratingdb node.js MongoDB web server demonstrating real-time round-trip editing of Revit element shared parameter values.
- Roomedit3dApp and the roomedit3d Forge Viewer extension demonstrating translation of furniture family instances in the viewer and updating the Revit BIM in real time via a socket.io broadcast.
Here is an image showing the links and relationships between BIM, cloud, Revit, node.js and MongoDB and explaining how and where fireratingdb and the three FireRatingCloud components fit into the picture:
I created this drawing using draw.io, and the source XML file is provided.
All REST API calls on the desktop are handled by the shared .NET class library FireRating.dll and passed to the firerating
database in MongoDB via the node.js web server. It contains one single collection doors
containing door data JSON documents. Other clients can connect to that server as well, from any kind of device. Both the node web server and the mongodb database can actually be run either in the cloud or locally on your own system, even on the Windows system running Revit. These two choices are controlled by Boolean flags in the FireRating library and web server, respectively.
Only a few technical users will interact with full-fledged Revit and the BIM. A much larger number of all kinds of users can be provided access to relevant subsets of the BIM data using this technology. This and others samples demonstrate how that access can include real-time editing and BIM updating, if you so please. The FireRatingCloud sample is intentionally kept simple and limited to managing and providing access to one single shared parameter value. The RoomEditorApp shows how you can extract and interact with graphical data as well, including graphical interaction on any mobile device with a simplified 2D view rendered using SVG in the browser.
For more information, please refer to The 3D Web Coder, The Building Coder and the detailed articles describing the entire project implementation and evolution, including first learning steps using mongo, implementing a REST API for it, and using that from a C# .NET desktop app:
- FireRating in the Cloud
- My first mongo database
- Define the over-all goal and what to store, namely building projects, door instances hosted in them, and each door's fire rating value, based on the venerable old Revit SDK FireRating sample.
- Implementing relationships
- Define a more complete schema that includes information about the container projects, i.e., the Revit RVT BIM or building information model project files.
- Define and maintain the relationships between the door family instances and their container projects.
- Starting to Implement the FireRating REST API
- Adding a REST API to populate and query the database programmatically.
- Put, Post, Delete and Curl Testing a REST API
- Populating MongoDB via C# .NET REST API
- Installing MongoDB on Windows
- Running MongoDB and the node.js web server on Windows
- Storing a document in mongo via REST API from C# .NET
- Generating the JSON data representing a project document
- Using JavaScriptSerializer to format JSON data
- Hand-formatted JSON project data
- The new project document in the mongo database
- Complete C# .NET REST API GET and PUT MongoDB Storage
- Complete FireRatingCloud Round Trip
- Revit project identification
- Complete Revit Add-in Implementation
- Demo Run Log
- Demo Video
- FireRating Database on Mongolab – really in the cloud
- Postman does more than cURL
- Wrap-up and Download
- FireRatingCloud fully cloud-deployed to Heroku + Mongolab
- Database hosted on mongolab.com
- Node.js web server hosted on Heroku
- Using the Mongo Console on a Remote Database
- Replace
HttpWebRequest
byRestSharp
and improve the REST API PUT implementation: - Using RestSharp for Rest API GET
- Mongodb Upsert
- C# DoorData and Node.js DoorService Classes
- FireRating in the Cloud presentation and project overview at RTC
- Connecting Desktop and Cloud recording for the AEC booth at AU
- FireRatingClient and the Spanish nature of connectivity
- FireRatingCloud REST API batch upload and Windows client
- Database document modification timestamp
- Retrieving updated db docs
- Real-time BIM update with FireRatingCloud 2017
- Real-time BIM update via a Windows Forms client
- FireRatingCloud Context and Architecture
To install:
- Fork the repository.
- Clone to your local system.
- Load the solution file in Visual Studio.
- Compile the add-in, producing the .NET assembly DLL FireRatingCloud.dll.
- Install by copying the add-in manifest file and the .NET DLL assembly to on of the standard Revit add-in locations, for example
C:\Users\tammikj\AppData\Roaming\Autodesk\Revit\Addins\2017
.
If you do not know what this means, please refer to the GitHub and Revit programming getting started guides.
As explained above, FireRatingCloud interacts with the fireratingdb node.js web server and MongoDB database.
You can run both the web server and the database either locally, on your own system, or on the web, for instance using Heroku to host the web server and mongolab for the database.
For the web server, this choice is made by the C# Revit add-in and its the Boolean variable Util.UseLocalServer
, which toggles the base URL being used between these two constants:
const string _base_url_local = "http://127.0.0.1:3001";
const string _base_url_global = "http://fireratingdb.herokuapp.com";
The web server in turn decides where to look for the database, again by setting the appropriate URL like this in server.js
:
var localMongo = false;
if(localMongo) {
// local database
var mongo_uri = 'mongodb://localhost/firerating';
} else {
// mongolab hosted
var mongo_uri = 'mongodb://revit:revit@ds047742.mongolab.com:47742/firerating';
}
If you host both the web server and the database on the web, i.e., both UseLocalServer
and localMongo
are set to false
, you have no more to set up.
If you are running some components locally, you need to install and run MongoDB and/or Node and the fireratingdb app itself on your system.
Good luck and have fun!
Just to check whether the node.js mongodb web server is up and running and see its version number, navigate to fireratingdb.herokuapp.com.
The online database is hosted on mLab. Look at the doors collection in the firerating database.
You can filter for your specific test data by setting the Revit Mark under Identity data in the BIM properties, and search for it in the database under the tag
property,
e.g. {"tag": "jeremy"}
.
FireRatingCloud implements five commands:
- Create and bind shared parameter –
Cmd_1_CreateAndBindSharedParameter
- Export shared parameter values one by one –
Cmd_2a_ExportSharedParameterValues
- Export shared parameter values in batch –
Cmd_2b_ExportSharedParameterValuesBatch
- Import shared parameter values –
Cmd_3_ImportSharedParameterValues
- Subscribe to real-time BIM update –
Cmd_4_Subscribe
This standard procedure is unchanged from the original FireRating Revit SDK sample.
Gather the door data element by element and export each data record to a MongoDB JSON document.
If a corresonding document already exists in the dtabase, it is updated.
If not, a new document is created.
This requires a separate REST call for each door element.
Export all door data records for the entire project to MongoDB JSON documents in one single batch call.
No possibility to update existing documents was found, so all existing documents related to this project are first deleted.
In other words, this export operation requires two REST calls: one to delete existing records, and one to export the data.
As soon as more than two doors are present in the project, the batch export will be faster than the individual export.
All door fire rating values for the entire project are read from the database in one single REST call and used to update the existing element data.
This command implements a Revit ribbon toggle button that switches back and forth between Subscribe
and Unsubscribe
.
When subscribing, a continuous database polling loop is started that checks the database for updated door data documents pertaining to the current Revit project every 500 milliseconds or so.
When updated documents are detected, an external event is raised. The event handler provides a valid Revit API context in which the updates can be applied to the BIM.
The detailed implemenation is discussed in the post on real-time BIM update with FireRatingCloud 2017.
- Subscribe to a push notification event from fireratingdb to trigger the external event whenever changes are made, instead of continuous polling like the room editor. Does this exist at all? Is it possible? This subscription is obviously project specific; only documents realted to the current project are of interest.
- On document change, update the fireratingdb push notification subscriptionn to the new current document.
- The stand-alone FireRatingClient displays data from all projects and therefore needs a different global subscription, not tied to a specific project.
- Implement batch upload. Previously, data upload was only processed element by element, whereas download is implemented using one single much more effective batch call.
- Implement an external event for real-time BIM update subscription like the room editor.
- Jose Ignacio Montes, @montesherraiz, Avatar BIM, implemented FireRatingClient.
- Jeremy Tammik, The Building Coder and The 3D Web Coder, Forge Platform Development, ADN Open, Autodesk Inc.
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.