Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

autodesk forge - How to open .rvt file from zip?

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:AcesJobs1532f21bb19d4605b941472d4961ed96input.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}}"
            }

    }
}
question from:https://stackoverflow.com/questions/65947278/how-to-open-rvt-file-from-zip

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.7k users

...