Warm tip: This article is reproduced from serverfault.com, please click

How to open .rvt file from zip?

发布于 2021-01-29 00:46:03

I am trying to open the Revit file from the zip folder in Design Automation for Revit, and getting an error:

>  Autodesk.Revit.Exceptions.FileNotFoundException: The filePath:T:\Aces\Jobs\1532f21bb19d4605b941472d4961ed96\input.rvt to be opened doesn't exist.

I've tried with different parameters for "localname" and "pathInZip" but still get this error

I am opening my model with OpenOptions:

var path = ModelPathUtils.ConvertUserVisiblePathToModelPath("input.rvt");
        var openOptions = new OpenOptions();
        openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;
        Document doc = rvtApp.OpenDocumentFile(path, openOptions);

My activity:

   {
    "commandLine": [
        "$(engine.path)\\\\revitcoreconsole.exe /al \"$(appbundles[AppBundle].path)\""
    ],
    "parameters": {
        "inputFile": {
            "zip":true,
            "verb": "get",
            "description": "Input Revit model",
            "required": true,
            "localName":"input.rvt"     
        }       
}

My workitem :

{
    "activityId": "activityId",
    "arguments": {
        "inputFile": {
        "pathInZip":"test.rvt",
            "url": "https://developer.api.autodesk.com/oss/v2/buckets/my_bucket/objects/test.zip",
            "Headers": {
                "Authorization": "Bearer {{Bearer}}"
            }

    }
}
Questioner
Volodymyr Dobrzhanskyi
Viewed
0
Emma Zhu 2021-01-29 09:38:52

With the definition below, Design Automation will uncompressed the zip to a folder named as "input.rvt", then look for a file named as "test.rvt" inside the folder if needed.

"parameters": {
        "inputFile": {
            "zip":true,
            "verb": "get",
            "description": "Input Revit model",
            "required": true,
            "localName":"input.rvt"     
        }
    "arguments": {
        "inputFile": {
        "pathInZip":"test.rvt",
            "url": "https://developer.api.autodesk.com/oss/v2/buckets/my_bucket/objects/test.zip",
            "Headers": {
                "Authorization": "Bearer {{Bearer}}"
            }
    }

About usage of zip and pathInzip, you can refer to forge doc -->arguments-->*--> XrefTreeArgument--> pathInZip Or DWG Sheet Combination failing on AutoDesk Forge to see how you would like to use.