11 May 2020

Difference of 3D Models by Autodesk.DiffTool Extension

Follow @Xiaodong Liang

It is a hot topic how to know the difference of models. My colleague Michael has produced a cool blog to compare 2D sheets by ‘PixelComparison’ extension. In the past, Augusto also shared a demo to compare 3D models by comparing the elements one by one. It is a feasible sample, while it would hit performance issue if with large model. Madhukar introduced a way to take advantage of COMPARE command of AutoCAD to compare drawings on Forge Design Automation, however this applies with DWG files only and depends on Design Automation service.

Today, I am introducing an interesting extension Autodesk.DiffTool. If you are familiar with the feature of Change Visualization of BIM360 Design Collaboration, this is almost the same extension with the same experience.


To work with this extension, firstly aggregate multiple models (in this context model versions) , then load the extension by configuring the options. In the available options:

  • primaryModels (required): An array of loaded Autodesk.Viewing.Model instances that participate in the diff operation as the current / as-is state - in terms of added, removed, modified objects. 
  • diffModels (required): An array of other loaded Autodesk.Viewing.Model instances that participate in the diff operation as the previous state. Length must match primaryModels to define pairs of models to be compared.
  • versionA (required): Version identifier of the primary models, e.g. '2', 'Version 2' or '02/26/2018'.  
  • versionB (required): Version identifier of the diff models, commonly lower than versionA.
  • mimeType (required): Through defining a mimeType the internal logic is slightly adapted to better extract disciplines, categories and names out of the model. Currently supported mime types. e.g.:
    • 'application/vnd.autodesk.revit': Revit
    • 'application/vnd.autodesk.autocad.dwg' : For DWG 
    • 'application/vnd.autodesk.navisworks' : For Navisworks (NWD) 

This extension provides split views or overlay views. It provides the ability to manipulate a few disciplines, e.g. view structure/MEP changes only, view removed elements only etc. The individual changes can also be located easily.  

The below is a code snippet to load the extension by the option of two models, as the topmost animation demos.

 var extensionConfig ={}
    extensionConfig.mimeType ='application/vnd.autodesk.revit'
    extensionConfig.primaryModels = [viewer.getVisibleModels()[1]]
    extensionConfig.diffModels = [viewer.getVisibleModels()[0]]
    extensionConfig.diffMode =  'overlay' 
    extensionConfig.versionA =  '2' 
    extensionConfig.versionB =  '1'  
    viewer.loadExtension('Autodesk.DiffTool', extensionConfig)
    .then(function(res) {
        window.DIFF_EXT = viewer.getExtension('Autodesk.DiffTool');
    .catch(function(err) {

The complete demo code is available at https://github.com/xiaodongliang/forgeviewer-diff-tools-extension . 



Notes and Limitations:

  • This extension can work with SVF-based models or SVF2-based models.
  • There is not yet web service that tells the difference of versions on the cloud. Currently, you may have to load models and use DiffTool to analyze. While if the models are managed on BIM360, a new web service to compare model versions is on the plan to be exposed in the future. Please watch our update.
  • The viewer must be set a width and height, otherwise, after the diffTool extension, the viewer will be shrunk to 0 


Related Article

Posted By

Xiaodong Liang

Xiaodong Liang has been with Autodesk since 2007, focusing on providing programming support, consulting, training and evangelism to external developers. He started his career China and now lives in Beijing, China. Xiaodong is currently a developer consultant in the team Developer Technical Services (DevTech), the worldwide team of API gurus providing technical services through the Autodesk Developer Network. He...