Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...