The Building Coder

Highlighting Revit Rooms in the Forge Viewer

I am leaving Athens today.

The Athens Forge meetup and web server workshop at The Cube went well.

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.

At the recent Barcelona Forge Accelerator, I talked with Jaroslav Daníček of CAD Studio a.s..

Jaroslav very kindly shared his hard-won experience and algorithm how to highlight a specific Room in the Forge viewer.

The Forge Viewer discussion forum includes some other hints on handling Revit rooms that might be worth mentioning first.

Accessing Room Data

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.

Automatically Navigating to a Specific Room

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:

Highlighting a Specific Room in the Forge Viewer

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:

Revit side:

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):

Here are some sample images:

A clean level cut:

Viewer highlight room — a clean level cut

A complicated room shape:

Viewer highlight room — a complicated room shape

A simple room shape next to the complicated one:

Viewer highlight room — 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!

Forge Viewer Extension Starting Points

If you are looking for handy starting points, you can look at my roomedit3d sample, Kean Walmsley's introduction to creating extensions and vertical toolbar extension, and, above all, the mother of them all, Philippe Leefsma's collection of JavaScript extensions for the viewer and gallery.

Maxim @redcraft Gurkin's lmv-extensions also look interesting... has anyone taken a look at them?