I completed the roomedit3dv3 project:
- Enhancements to the Forge Node.js boilerplate code
- RoomEditorApp Revit add-in update
- Roomedit3dv3 demo recording
- Samples connecting desktop and cloud
Before I get to that, I should also mention that the Forge webinar series session 5 is being held today, by Albert Szilvasy, on the Design Automation API.
You can register by clicking here.
Forge Webinar Series 5 – Design Automation API
Recordings, presentations and support material of the past sessions are available for viewing and download:
- September 20 – Introduction to Autodesk Forge and the Autodesk App Store
- September 22 – Introduction to OAuth and Data Management API – on OAuth and Data Management API, providing token-based authentication, authorization and a unified and consistent way to access data across A360, Fusion 360, and the Object Storage Service.
- September 27 – Introduction to Model Derivative API – on the Model Derivative API that enables users to represent and share their designs in different formats and extract metadata.
- September 29 – Introduction to Viewer – the Viewer, formerly part of the 'View and Data API', is a WebGL-based JavaScript library for 3D and 2D model rendering of CAD models from seed files, e.g., AutoCAD, Fusion 360, Revit and many other formats.
Upcoming sessions continue during the remainder of the Autodesk App Store Forge and Fusion 360 Hackathon until the end of October:
- October 4 – Design Automation API – formerly known as 'AutoCAD I/O', run scripts on design files.
- October 6 – BIM360 – develop apps that integrate with BIM 360 to extend its capabilities in the construction ecosystem.
- October 11 – Fusion 360 Client API – an integrated CAD, CAM, and CAE tool for product development, built for the new ways products are designed and made.
- October 13 – Q&A on all APIs.
- October 20 – Q&A on all APIs.
- October 27 – Submitting a web service app to Autodesk App store.
Quick access links:
- For API keys, go to developer.autodesk.com
- For code samples, go to github.com/Developer-Autodesk
Feel free to contact us at [email protected] at any time with any questions.
Back to the room editor:
Enhancements to the Forge Node.js Boilerplate Code
Roomedit3dv3 builds on Philippe Leefsma's
Forge node.js boilerplate samples,
adding a few simple enhancements in order to demonstrate interactive movement of BIM element instances in the Forge viewer and updating the Revit model accordingly in real time via a socket.io
broadcast.
The additional enhancements include:
- Adding a viewer
transform
extension. - Retrieving and broadcasting the affected element
UniqueId
and translation viasocket.io
.
I created a new Forge app for the production version, set up its PROD
environment and deployed to Heroku with no major issues.
Everything went well, as you can see below in my description of the Revit add-in adaptation and test run.
Here is are all the nitty-gritty details on choosing a suitable starting point and adapting the boilerplate code for my needs:
- Roomedit3d Update for Connecting Desktop and Forge
- More Roomedit3dv3 Starting Points
- The Birth of Roomedit3dv3
- REST vs WebSocket and Roomedit3dv3 Broadcast Architecture
- Roomedit3dv3 Transform Viewer Extension
- Retrieving and Broadcasting the Roomedit3dv3 Translation
Now that the web server part is complete, let's test it from Revit:
RoomEditorApp Revit Add-in Update
The socket.io
broadcast is picked up by the Roomedit3dApp Revit add-in and applied to the Revit model just like in previous versions.
All I had to do was update the socket.io
URL.
I also added a check for the correct Revit project document and a valid element UniqueId
, since the viewer extension might be running in any number of instances for various users at the same time, and no information is currently added to the socket.io broadcast to tell which Revit model is being edited by who.
Therefore, in the current implementation, you might be bombarded with millions of transform messages from all the thousands of different users playing with this simultaneously worldwide.
Thus the importance of checking whether the notification you just received really does apply and can be applied to your current document.
Here is the new BimUpdater.Execute
method implementation that hopefully takes care of that:
/// <summary> /// Execute method invoked by Revit via the /// external event as a reaction to a call /// to its Raise method. /// </summary> public void Execute( UIApplication a ) { Debug.Assert( 0 < _queue.Count, "why are we here with nothing to do?" ); Document doc = a.ActiveUIDocument.Document; // Ensure that the unique id refers to a valid // element from the current doucument. If not, // no need to start a transaction. string uid = _queue.Peek().Item1; Element e = doc.GetElement( uid ); if( null != e ) { using( Transaction t = new Transaction( doc ) ) { t.Start( GetName() ); while( 0 < _queue.Count ) { Tuple<string, XYZ> task = _queue.Dequeue(); Debug.Print( "Translating {0} by {1}", task.Item1, Util.PointString( task.Item2 ) ); e = doc.GetElement( task.Item1 ); if( null != e ) { ElementTransformUtils.MoveElement( doc, e.Id, task.Item2 ); } } t.Commit(); } } }
I tagged the new Roomedit3dApp version release 2017.0.0.6.
Roomedit3dv3 Demo Recording
With everything up and running smoothly, I created a ten-minute demo recording on the Roomedit3dv3 Revit BIM Autodesk Forge Viewer Extension:
To summarise, it demonstrates real-time round-trip editing of Revit BIM via the Autodesk Forge Viewer using
Roomedit3dv3, which implements
a Forge Viewer extension to move building elements and update the Revit BIM in real-time using socket.io
.
You can easily deploy your own version of it to Heroku with one simple button click, cf. the instructions in the GitHub repository, or test run my own web personal server instance directly at roomedit3dv3.herokuapp.com.
Further Samples Connecting Desktop and Cloud
I continue testing and documenting the other samples connecting the desktop and the cloud for the RTC Revit Technology Conference Europe in Porto, each consisting of two components, 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 SVG 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 stored in a globally accessible mongolab-hosted db.
- Roomedit3dApp and the first roomedit3d Forge Viewer extension demonstrating translation of BIM elements in the viewer and updating the Revit model in real time via a 'socket.io' broadcast.
- The sample discussed above, adding the option to select any Revit model hosted
on A360, again using
the Roomedit3dApp Revit add-in working with the
new roomedit3dv3
Autodesk Forge
Viewer extension
to demonstrate translation of BIM element instances in the viewer and updating the Revit model in real time via a
socket.io
broadcast.
All is still looking good so far.