23 May 2022

Make composite Revit design work with Design Automation API for Revit

Default blog image

 

Recently, a few questions came from our customers more frequently like the following. So, here we are!

  • "How can we send zipped Revit design containing linked models from BIM360 to DA?", or 
  • "When downloading the Revit cloud worksharing model, I got a ZIP package rather than a single RVT file. How can I configure my workitem input?"

Why do I get a ZIP package that contains the host and linked RVT models rather than a single RVT file?

With our observations, the root cause is that one or more linked models have not yet been published with their latest (synced) version, while the host file is published to Cloud Model when working with the Revit Cloud Worksharing model or so-called C4R model. Therefore, when downloading the host RVT file, BIM360 Docs/Autodesk Docs will give you a ZIP package rather than the host RVT file itself.

 

Please check out Why an RVT model is (sometimes) downloaded as ZIP from BIM 360 for detailed explanations.

How can I know if the download file is a ZIP package (composite design) or a single RVT file?

1. First, let's figure out how to tell if an item we're looking for is a Cloud Model published from a Revit Cloud Worksharing model. While calling the following APIs, if you can see the file item's either version tip has this value `versions:autodesk.bim360:C4RModel` under `attributes.extension.type` like the below one, it means this file is a Revit Cloud Worksharing model.

{
    "type": "versions",
    "id": "urn:adsk.wipprod:fs.file:vf.b909RzMKR4mhc3O7UBY_8g?version=4",
    "attributes": {
        "name": "rac_basic_sample_project.rvt",
        "displayName": "rac_basic_sample_project.rvt",
        "createTime": "2022-01-28T08:45:55.0000000Z",
        //...
        "lastModifiedTime": "2022-01-28T08:51:44.0000000Z",
        //...
        "versionNumber": 4,
        "mimeType": "application/vnd.autodesk.r360",
        "storageSize": 111297725,
        "fileType": "rvt",
        "extension": {
            "type": "versions:autodesk.bim360:C4RModel",
            "version": "1.1.0",
            "schema": {
                "href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.bim360:C4RModel-1.1.0"
            },
            "data": {
                "modelVersion": 3,
                "isCompositeDesign": true,
                "mimeType": "application/vnd.autodesk.r360",
                "compositeParentFile": "rac_basic_sample_project.rvt",
                "projectGuid": "733f13b0-502d-4a1e-6624-b7f22f920290",
                "originalItemUrn": "urn:adsk.wipprod:dm.lineage:b909RzMKR4mhc3O7UBY_8g",
                "modelType": "multiuser",
                "latestEpisodeGuid": "fda2d360-5466-4ev3-b051-0dacbaa509f5",
                "modelGuid": "d1e3bc70-30d0-4e42-86a5-9d00da685TAf",
                "processState": "PROCESSING_COMPLETE",
                "extractionState": "SUCCESS",
                "splittingState": "NOT_SPLIT",
                "reviewState": "NOT_IN_REVIEW",
                "revisionDisplayLabel": "4",
                "sourceFileName": "rac_basic_sample_project.rvt",
                "conformingStatus": "NONE"
            }
        }
    },
    // ...
}

Note. If the above `attributes.data.modelType` value is `singleuer`, it means this model was saved by `Revit's Save As Could Model`. Therefore, this model is not a Revit Cloud Worksharing model.

 

2. After confirming that the Revit file is a Revit Cloud Worksharing model, we look at the `isCompositeDesign` value under `attributes.data`.

When `isCompositeDesign` is true, it stands that this model is a composite Revit design. When downloading the file from BIM360 Docs/Autodesk Docs, or following the tutorial Download Files from BIM 360 Document Management to download it from Forge OSS service, we will get a ZIP package containing the host and linked RVT files.

On the contrary, if `isCompositeDesign` is false, we will obtain a single RVT file instead. This means all RVt files, including host and links, were published with the last version. See Why an RVT model is (sometimes) downloaded as ZIP from BIM 360 for details.

How to configure workitem for a Revit composite design?

After we confirm that the Revit file is a composite design, we can get the host Revit filename under `attributes.data.compositeParentFile` of the file version tip like the below:

"data": {
    // ...
            "isCompositeDesign": true,
            "mimeType": "application/vnd.autodesk.r360",
            "compositeParentFile": "rac_basic_sample_project.rvt",
    // ...
            "modelType": "multiuser",
    // ...
}

Afterward, we can configure the workitem by these:

  • The value of `arguments.inputFile.zip` is taken from `attributes.data.isCompositeDesign` of the file version tip.
  • The value of `arguments.inputFile.pathInZip` is taken from `attributes.data.compositeParentFile` of the file version tip.

For example, I'm sending a DXF export task of my sample project DA4R-DxfExporter using the workitem configuration below.

{
  "activityId": "Kangs.DxfExporterActivity+dev",
  "arguments": {
    "inputFile": {
      "verb": "get",
      "url": "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/9fbf5708-3599-4b62-b44e-b2c142407996.rvt",
      "zip": true,
      "pathInZip": "rac_basic_sample_project.rvt",
      "headers": {
        "Authorization": "Bearer {{Bearer}}",
        "Content-Type": "application/octet-stream"
      }
    },
    "inputJson": {
      "verb": "get",
      "url": "data:application/json,{ 'exportAll': 'true' }"
    },
    "outputDxf": {
      "verb": "put",
      "url": "https://developer.api.autodesk.com/oss/v2/signedresources/ebfa3a4b-1502-51b5-93f3-0c72eb73ac77?region=US"
    }
  }
}

 

That's all! Hope you enjoy the above and have fun with Design Automation API for Revit!

Related Article