How can I get links between models on BIM 360?

837 Views Asked by At

I am trying to build a script that transfers files from the Project Files subfolders to the Plans subfolders.

In my BIM 360 Docs I have .rvt models that are linked (e.g. HVAC model linked to the architecture 3D model). When I download a linked model (manually or via the Forge API), I get a .zip file with all the linked models in it.

Is it possible to check which models are linked to an item via the Forge APIs and also in which folder those linked models are stored?

Thank you for your help.

Edit: I tried getting those links by calling versions/:version_id/relationships/refs, but it only shows copies I made from the file.

The links I am trying the get are created in Revit via Insert > Link Revit > Add... and then selecting a file from BIM 360.

Also, when uploading this kind of file (with linked models) manually, to do it correctly I need to select the "upload linked files" option in BIM 360 and then select the parent file.

2

There are 2 best solutions below

3
On

After you get one version id of one file, you could call versions/:version_id/ relationships/refs. It will tell the relationships of this file with other files. In the structure, fromId is the root file, toId is the xref file. So, if fromId is same to the version_id, that means this file you are checking is a root file. Otherwise, it is one xref (linked) file.

And in the relationships, it will also tell the information of all xrefs file.

The below is the example with my test files.

Root file is urn:adsk.wipprod:fs.file:vf.z4KMn52OT5OIuKamXnzmFw?version=1

Linked file is urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1

Using version id of root file:

https://developer.api.autodesk.com/data/v1/projects/ /versions/ urn%3aadsk.wipprod%3afs.file%3avf.z4KMn52OT5OIuKamXnzmFw%3fversion%3d1/relationships/refs

it returns the structure:

  "data": [
    {
        "type": "versions",
        "id": "urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1",
        "meta": {
            "refType": "xrefs",
            "fromId": "urn:adsk.wipprod:fs.file:vf.z4KMn52OT5OIuKamXnzmFw?version=1",
            "fromType": "versions",
            "toId": "urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1",
            "toType": "versions",
            "direction": "from",
            "extension": {
                "type": "xrefs:autodesk.core:Xref",
                "version": "1.0",
                "schema": {
                    "href": "https://developer.api.autodesk.com/schema/v1/versions/xrefs:autodesk.core:Xref-1.0"
                },
                "data": {}
            }
        }
    }
],
0
On

I also had a lot of trouble to follow links between Revit files on BIM360/ACC and after a lot of research, the situation seems as follows:

  • There is no way to get links/references for models that are composite designs (ie. downloadable as zip files)
  • For non-composite models, your mentioned relationships/refs endpoint will return incoming and outgoing references correctly

To check wether an item (revit file) is a composite design or not, check projects/:project_id/items/:item_id/versions. This will return an array of versions, each with attributes.extension.data.isCompositeDesign (bool). If you find versions with isCompositeDesign=false, you can use the relationships/refs endpoint to get all references (of that version).

A model will become composite once there are referenced items with unpublished changes. See here for more details on composite design and here for troubleshooting the creation of cloud compatible links/references.

Models that are composite designs will contain all referenced files including the source file in one zip file. It is noteworthy that the zip file will not contain referenced references, ie. it does not follow references. In other words: If a composite design model references models that are composite designs themselves, the zip file will not contain the zip file of the composite design reference, but only the reference (rvt file) without its references. This makes it very hard, if not impossible, to use design automation in real world scenarios where models often contain sub-references (reference of a reference) and not all the models along the reference chain are untouched, published models.