0

I have a forge viewer loading a document with multiple viewables from a Revit project in BIM360. I can see all viewables rendered just fine. I'm using Autodesk.AEC.ViewportsExtension to display certain elements on the viewer at specific locations, e.g. tags. I managed to successfully show tags by following a blog post by Petr, but some viewer models fail to return any viewport.

    viewportExt = viewer.getExtension("Autodesk.AEC.ViewportsExtension");
    viewport = viewportExt.getViewports(viewer.model)[0]; // this returns null
    viewportXform = viewport.get3DTo2DMatrix(viewer.model.getUnitScale());

this works for some viewables but some don't return any viewports which I need, to translate between 3D and 2D spaces. I can see AEC metadata is loaded in both cases. I am at a loss why only certain views fail to return viewports.


I just tried Petr's sample with my own models in BIM360. My viewables from the Revit projects are not returning any viewports. I suspect this has something to do with what's happening during BIM 360 publish process.

Any advice would be greatly appreciated.

2 Answers2

1

According to our BIM360 user manul here, the Crop View checkbox enabled is required.

  • Newly published data. It does not work for previously published models.
  • 2D sheets with floor plan views, structural plan views, or reflected ceiling plan views. Other sheets with callout or area plan views are not supported currently.
  • Sheets with the Crop View checkbox enabled in Revit.
  • Views without view breaks. Views containing view breaks or view splits are not supported currently.
Eason Kang
  • 6,155
  • 1
  • 7
  • 24
0

In both cases, I could get the list of all viewports that are published from Revit projects in BIM 360, including guids of the viewports. However, I still could not get a viewport object for use with the viewport extension, even with findViewportByGuid().

After some research and digging around the model data loaded in the forge viewer, I noticed those published views that I cannot get viewport objects from did not have geometryViewportRegion property, and isCropBoxActive value was set to false.

I am guessing this is why getViewports() returns null for those views. From what I can read from the AEC extension source code, get3Dto2DMatrix(vp, sheetUnitScale) also requires viewport boundary, so I guess I can't translate from 3D coordinates to 2D coordinates without having viewport boundary explicitly defined for the Revit view.

I could fix the issue by checking "crop view" checkbox in the Revit view property for those views, although I was hoping to keep it unchecked so I can have the view published with everything visible without any view boundary.