'How can I find which Revit files are linked in BIM 360 via Forge?

In certain circumstances, BIM360 will serve a zip file of a Revit document along with its links, such as explained here: https://forums.autodesk.com/t5/bim-360-document-management/linked-revit-files-in-bim-360-docs/td-p/8774004

In this circumstances, however, when interacting with GET projects/:project_id/folders/:folder_id/contents the file still is shown as a regular file (potentially the isCompositeDesign attribute distinguishes it) with a .rvt file extension. In addition, the filesize shown in storageSize of the object is the sum of the main Revit file and all of its links. Checking the details in GET buckets/:bucketKey/objects/:objectName/details equally show the size object size attribute to be the sum of the main Revit file and all of its links.

I cannot seem to find functionality in Forge that:

  1. Distinguishes a zip file from a lone file (potentially the isCompositeDesign attribute does this)
  2. Provides a list of which other files are linked into the main file, or a list of the zip file contents and their URNs.
  3. Provides a true filesize of the main revit file itself, not just the sum of all linked files in the zip.

Ideas?



Solution 1:[1]

Revit 4 worksharing, publishes a file to BIM360.

This file is named as a .rvt file (ie. 'mybigrevitproject.rvt'), but in fact, it's really a zip file in disguise. If you rename it to zip, download it, and unzip it, you'll find lots of .RVT inside the zip.

There's a neat trick to figuring this out, without downloading the entire file.

Use a range GET on the first 16 bytes, and check for the magic header.

For full details, check out this repo: https://github.com/wallabyway

Here's a snippet of the code that will help: https://github.com/wallabyway/bim360-zip-extract/blob/master/server.js#L167

I think it's related to this question: Forge Data management returns zip file

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 michael beale