Search code examples
autodesk-forgeautodesk-viewerautodesk-model-derivative

Aligning Multiple Revit Files in Autodesk 3D Viewer


I am currently working with several Revit files in an Autodesk Construction Cloud (ACC) project. One of these files includes the site and landscaping details, while another incorporates the foundation of the building. When working within Revit, linking these files together works seamlessly since they both utilize the same project base point, ensuring accurate placement of the foundation.

However, the issue arises when attempting to load these files simultaneously into a single instance of the 3D viewer. The alignment between the files is lost. As I understand, the 3D viewer centers the bounding box of the geometry within the 3D world. Moreover, I am aware that the SVF2 format used during the derivation process does not retain any data regarding the project's coordinate system.

Given these constraints, I am interested in learning if there's a possible workaround that enables loading multiple files into a single 3D viewer instance and aligning them based on their Revit origins, as opposed to centering around the bounding box. Any assistance or insights to address this concern would be greatly appreciated.

I am able to successfully interact with the APS API and load multiple Revit files that have been uploaded to an ACC project into the same instance of the viewer. However, they are not aligned to each other in the same way that they were in Revit.


Solution

  • We can align Revit models in APS Viewer with the below ways, but please ensure your Revit models are aligned well with the alignment you want to achieve in the viewer.

    I put the logic in my MultipleModelUtil.js, and demonstrated this tool in this lightning talk: Aggregation, linked models, and group: advanced Revit model viewing in Autodesk Forge

    • Origin to Origin: Apply the globalOffset of the 1st model to others. (if the models are co-origin of the Revit internal origin, applying the same globalOffset to the models should make them aligned well in the viewer)
      const util = new MultipleModelUtil( viewer );
      
      util.options = {
        alignment: MultipleModelAlignmentType.OriginToOrigin
      };
      util.processModels( models );
      
    • Center to center: The default way of the viewer
      const util = new MultipleModelUtil( viewer );
      
      util.options = {
        alignment: MultipleModelAlignmentType.CenterToCenter
      };
      util.processModels( models );
      
    • By shared coordinate: Set up applyRefpoint: true and make the globalOffset to the refPoint. (AEC model data is required)
      const util = new MultipleModelUtil( viewer );
      
      util.options = {
        alignment: MultipleModelAlignmentType.ShareCoordinates
      };
      util.processModels( models );
      

    ref: