A while ago, I got a request from our Forge viewer users about initializing a viewer without loading any model. Basically, it's impossible to use the viewer in that way currently since some viewer configurations are determined during the load process as I know. However, I provided a workaround to the empty viewer thread on the StackOverflow. To simulate it, we can do something like this:
Loading a dummy model that contains very very tiny points like the maximum and minimum points of a bounding box to make it look like there is no model loaded. Before loading new models, you have to unload this dummy model firstly and call Viewer3D.tearDown() to release some used memories.
Now let's see how to achieve it. The following steps take advantages of the Revit generic family template and 3D view bounding box.
1. We have to create a Ghost Point family to represent the very very tiny points mentioned above, here is its look like:
2. Place two instances of this Ghost Point family to somewhere very close to both the maximum point and the minimum point of the default Revit 3D view bounding box like below.
To simply the work, I wrote a Dynamo script to speed this up:
Then adjust the offsets of these two ghost points to +30000 (the maximum point) and -30000 (the minimum point) from my trial and error. (If these two points are too closed to the maximum point or minimum point the view bounding box, they will disappear after Forge translation with my tests.)
3. Upload this Revit project to Forge server for translation and open it with the viewer as usual, and you will see a simulated empty view in the viewer. Here is the demo video:
Eason Kang is a member of the Autodesk Developer Network ADN DevTech team, focusing on providing programming support, consulting, training and evangelism to external developers. He started his career in Taiwan and now lives in Taipei, Taiwan. He is a developer consultant in the team DevTech, the worldwide team of API gurus providing technical services through the Autodesk Developer Network. He supports various...