View and Data API extension to move furniture family instances and update the Revit BIM
MIT License
View and Data API extension to move furniture family instances and update the Revit BIM in real-time using socket.io.
Based on the boilerplate project for View & Data API using a node server.
A Revit BIM model is translated for and displayed to the user by the Forge View and Data API.
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:
See below for further pointers to more detailed documentation.
Now that this text is growing even more, here is a full table of contents:
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:
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.
In a comment on The Building Coder discussion of the roomedit3d live real-time socket.io BIM update, Danny Bentley asked:
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.
In that version, you can log into your own A360 account, obviously exercising the Authentication API.
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:
The full detailed project documentation with detailed implementation description is provided by The 3D Web Coder and The Building Coder.
The 3D Web Coder discusses the Revit-independent aspects in the article on the Roomedit3d viewer extension, POST and socket.io, which also points to a six-minute demo recording showing:
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 externalId
.
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.
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.