16 Jan 2020

Export Clash to PDF

Follow @Xiaodong Liang

In the last blog, we see how to view single clash from the raw data that model coordination API provides. While in reality, it is more useful for the end customer to analyze clashes in a well organized view, of analyze clashes with specific criteria/filter or statistic etc. Another common use case is to export the clashes to a report to connect other workflows.

In BIM 360 UI, it allows the user to check clashes by documents with documents. It provides a breakdown tree view with those clashes of specific object in a document with the objects in other documents. By this way, the user can locate the clash by specific objects promptly. 

                                                         

a

Based on the idea of breakdown view, one API sample builds the similar view and extends the abilities. It supports searching object by name and exporting some interesting clashes to a PDF report, with snapshot of the clash.

https://github.com/Autodesk-Forge/forge-bim360-clashpdfexport

From technology perspective, the first step is to download the raw clash data, analyzes the data to build the mapping among the clash document, version URN and viewable guid etc. Finally, the code iterates each clash instances. For one element (lvid) of one clash, it dumps all clashes that this element (lvid) is involved, and groups them in by pair of documents.

c

 

 

This sample uses a free library jsPDF. By the default feature, we have to design the row, row space, text/image position, font style, page break, lines etc. So some parameters with the formatting is hard-coded. Some extended libraries are available on internet which maybe useful to save time to design a PDF.  e.g. This sample took one library jsPDF-AutoTable to make a table view.

To take snapshot, the code calls getScreenShot of Forge Viewer API, coverts to blob, and generate based64 code for jsPDF image. Because these are asynchronous methods, the workflow is combined with promised calls. 

 

q

 

 

 

Related Article