May 11, 2020

Difference of 3D Models by Autodesk.DiffTool Extension

Follow @Xiaodong Liang

top

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.

dc

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');
        console.log(window.DIFF_EXT);
    })
    .catch(function(err) {
        console.log(err);
    });

 

Notes and Limitations:

  • This extension can work with SVF-based models or OTG-based models (also called SVF2.0, but please note, this has not been formally released). There is one restriction currently: difference of OTG-based model only works for different versions of a single lineage. In other words, it doesn’t work for arbitrary two OTG models, while it could work with the models from the folder of BIM360 Design Collaboration because it is lineage format. In addition, to load OTG-based models from BIM360, please refer to the sample Michael produced.
  • 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.

 

Posted by

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 supports...

Related Posts