View and Data API extension to move furniture family instances and update the Revit BIM in real-time using socket.io.
A View and Data API extension client app enables user interaction to move selected elements around on screen.
The updated elements and their new locations are transferred to the node.js server via a REST API call.
The server uses socket.io to broadcast the updates.
This broadcast is picked up by the Roomedit3dApp C# .NET Revit add-in client.
Currently hardwired for a specific model; the selected element is identified via its Revit UniqueId.
This sample demonstrates two interesting aspects:
- Interactive model modification in the View and Data API viewer
- Communication path back from viewer client to node.js web server to desktop BIM
See below for further pointers to more detailed documentation.
Now that this text is growing even more, here is a full table of contents:
- Connecting desktop and cloud
- Interactive Model Modification in the View and Data API Viewer
- Communication Path Back from Viewer Client to Node.js Web Server to Desktop BIM
- Setting Up Your Own Model
- Roomedit3dV2 Using OAuth2 to Edit any Model
- Detailed Documentation on the Blogs
Roomedit3d 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.
The Roomedit3dTranslationTool implements a View and Data API viewer extension that enables the user to select a component and interactively move it around on the screen, defining a translation to be applied to it and communicated back to the source CAD model.
The View and Data API provides view functionality only, no edit.
The pre-defined communication path goes from the desktop to the cloud, from the source CAD model to the translated View and Data API buckets and JSON data bubbles.
This sample demonstrates an interactive modification of the three.js graphics presented by the View and Data API viewer, and a communication path to send updated element location information back to the desktop product in real time.
In this case, the source desktop CAD model is a Revit BIM, and the modifications applied are furniture family instance translations.
The viewer client in the browser uses fetch to implement a REST API POST call to communicate the modified element external id and translation back to the node.js server.
The node.js server uses a socket.io broadcast to notify the desktop of the changes.
The dedicated C# .NET Revit add-in Roomedit3dApp subscribes to the socket.io channel, retrieves the updating data and raises an external event to obtain a valid Revit API context and apply it to the BIM.
The roomedit3d web server displaying the View and Data API viewer and broadcasting the modified element translations is hosted on Heroku at roomedit3d.herokuapp.com. Look at the model displayed there. You can select and move arbitrary building elements.
If the Roomedit3dApp is up and running in Revit with the same model and subscribed to receiving the broadcast events, it will update the BIM accordingly.
This is very cool. I got everything downloaded and started going through the SocketTest and it worked great. I want to try the Roomedit3dApp, but in my zip file I don't seem to have the .rvt file of the room. Where could I find this file?
Answer: You can use any Revit BIM RVT project file you like.
It does not have to have anything to do with rooms at all, really, since any element will be accepted, moved, and the translation communicated back via the socket to the Revit add-in running in the same model.
Translate your RVT for the Forge viewer using your own credentials.
Adapt the roomedit3d viewer server to load it by specifying your own credentials and your translated model URN.
That is all all I can think of.
With that done, you should be ready to go.
Since I provided that answer, however, things have got easier still:
The Forge platform has now been redesigned and the View and Data API renamed.
To be more precise, what we so far considered the View and Data API has been restructured more cleanly into separate REST API endpoint collections:
I implemented a new version of Roomedit3d adapted to fit into that structure: roomedit3dv2.
You can test it live at roomedit3dv2.herokuapp.com.
The sample uses the Data Management API to list all hubs you have access to and the hierarchy of projects, folders, items and versions within them.
When you select a specific version, the Model Derivative API provides access to the internal CAD seed file structure, translates it for the viewer, and enables geometry export of selected elements.
Within the viewer, the
Roomedit3dTranslationTool can be turned on an behaves just as before:
- Select an element
- Transform its location
- Report the data back from the viewer to the web server via a REST API call
- Broadcast the data from the web server to the C# .NET clients to update the BIM
- View and Data API viewer running locally
- The viewer extension
- The node server logging the POST data received from the viewer when running locally, and forwarding it to the socket.io broadcast
- The same steps running Heroku-hosted in the cloud
- The console app connecting to the cloud and logging the translation messages as they are sent and received
The Building Coder summarises the entire state of the project today in the article on the Roomedit3d live real-time socket.io BIM update, which also points to a five-minute video recording showing the system up and running with the live connection from the View and Data API viewer directly into the Revit BIM.
[Q] I was successful in downloading Geometory Data of Revit Model (following this tutorial).
And I was successful in getting Revit Model Properties (tutorial).
But I can not find key for tying geometory with property.
Anyone know key for tying? or Anyone know how to tie both data ?
[A] The Revit Element
UniqueId property is included in the Forge translated result. In the Forge data, it is stored as the
An example of accessing the Forge information in the viewer in order to transmit changes back to the Revit BIM is provided by the roomedit3d sample.
Look at the Roomedit3dTranslationTool implementation.
- Philippe Leefsma, Autodesk Developer Network.
- Jeremy Tammik, The Building Coder and The 3D Web Coder, ADN Open, Autodesk Inc.