I completed the roomedit3dv3 project:
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.
Recordings, presentations and support material of the past sessions are available for viewing and download:
Upcoming sessions continue during the remainder of the Autodesk App Store Forge and Fusion 360 Hackathon until the end of October:
Quick access links:
Feel free to contact us at forgehackathon@autodesk.com at any time with any questions.
Back to the room editor:
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:
transform
extension.UniqueId
and translation via socket.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:
Now that the web server part is complete, let's test it from Revit:
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.
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.
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:
socket.io
broadcast.All is still looking good so far.