I am leaving Athens today.
Here are a couple of pictures before and after the events:
Now it is full steam ahead towards the Forge DevCon in San Francisco week after next.
Not to forget the 3D Web Fest on June 15, in parallel with Forge DevCon, showcasing the best of the 3D web as live performance art with a catered reception in a film festival atmosphere. This year all proceed go to the non-profit CODAME ART+TECH project.
Jaroslav very kindly shared his hard-won experience and algorithm how to highlight a specific Room in the Forge viewer.
The Forge viewer displays geometrical objects.
By default, the rooms in a Revit model do not generate any geometry.
However, their other information, attributes and parameters are all present in the translated model.
If you know the room element id, you can retrieve it from the translated viewer data.
It is not immediately accessible through the user interface, since there is no geometry associated with it.
A room is a void, and the viewer is mainly focused on displaying (non-void) geometrical objects.
You can easily implement your own extensions to retrieve, display and interact with the room data in any way you like.
One approach to automatically navigate to a specific room was implemented at the cloud accelerator in Prague in September last year by Jaroslav's colleague Vitezslav Peka:
Several participant interested in Revit models ran into this issue, and various solutions were implemented.
The simplest approach to zoom to a Revit room in the Forge viewer seems to be the following:
- Place a family instance with some geometry inside each room. You might want to place it at the ceiling level, somewhere in the 'centre' of the room, for the zooming and cutting described below.
- Save and translate the modified file, then discard it and revert to original state, e.g., by saving active doc A to new project B, open B in background, modify, save, translate, delete, continue working in A.
- Search in the viewer for the Revit
- That returns a list of the (invisible) rooms.
- Find the corresponding family instance for the room to retrieve its data.
- Get its bounding box in the viewer.
- Make a section cut at that location to show the room.
- Set the camera to the correct view and zoom.
Jaroslav took Vitezslav's solution one step further to implement Revit room highlighting in the Forge viewer. In his own words:
Here is what I did basically:
- Add lines for every room following its 'floor plan', so in the viewer every line has its own object and DbID.
- Sort them in order like 'drawn with pencil in one move', second line should start where previous ends.
- Upload Revit model to the cloud.
- Store information in the database which lines (respective DbIDs of lines) belongs to which rooms and their order.
If a room contains holes it is a little bit more complicated for drawing in the viewer; you must also store information whether a line represents a hole or main 'circle'.
Viewer side (for 3D models only):
- When selecting a room from the room list, identify the room and its lines in the database, via ajax send DbIDs of lines back.
- Now you have got array of DbIDs of lines.
- For every line get its start and end point; they provide coordinates for the vertices.
- Create a 2D shape from the vertices and extrude shape to height of a room or cut plane.
- From shape and extrusion setup create a mesh with transparent material and add it to the viewer.
- Set correct Z coordinate for the new mesh.
- For better orientation and visibility is good to set the cut plane to the height of a level where a room is located and animate the camera to look from above.
Here are some sample images:
A clean level cut:
A complicated room shape:
A simple room shape next to the complicated one:
Many thanks to Jaroslav for sharing these valuable hints!
Have fun implementing your own Forge viewer extensions!