Search code examples
autodesk-forgeautodesk-designautomation

Autodesk Forge Design Automation - Error Opening a model - How to bypass Dialog Box "Model has been transmitted from remote location"


I'm trying to use the Design Automation api to open a Revit model from our BIM360 account, eg. to upgrade it from a previous version of Revit

When I test locally, some rvt files display a dialog box during opening: Transmitted File - this file has been transmitted from a remote location - see image attached (this is a side effect from being downloaded from BIM360)

dialog box on file open Transmitted file

my question is - how can I bypass this dialog box so that the addin can work with Design Aurtomation (in which no UI, dialogs or warnings are supported)

I did some research on Jeremy T's posts on this issue, and found some information, about how to use the DialogBoxShowing event to catch and respond to dialog boxes before they appear.. https://thebuildingcoder.typepad.com/blog/2009/06/autoconfirm-save-using-dialogboxshowing-event.html

However, the problem is that this event is part of the UIApplication namespace, so is likely not available in the Design Automation cloud Revit engine https://www.revitapidocs.com/2017/cb46ea4c-2b80-0ec2-063f-dda6f662948a.htm

Also in any case it appears that this particular event is not fired when a model is opened https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/td-p/5578594

Any ideas about how I can open transmitted models for processing with Design Automation?

Thanks!
Ed G


Solution

  • The file from BIM 360 is a eTransmitted workshared files. To open such a file in DesignAutomation for Revit, you will need to use OpenOptions (DetachAndPreserveWorksets or DetachAndDiscardWorksets). If you preserve the worksets and would like to save the file, remember to use the correct SaveAsOptions.

    Explicitly specify a local name to your input file in your activity:

    {
      "alias": "prod",
      "activity": {
        "id": "YourActivity",
        "commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /al $(appbundles[YourBundle].path)" ],
        "parameters": {
          "rvtFile": {
            "zip": false,
            "ondemand": false,
            "verb": "get",
            "description": "Input Revit model",
            "required": true,
            "localName": "input.rvt",
          }
        },
        "engine": "Autodesk.Revit+2020",
        "appbundles": [ "YourName.YourBundle+label" ],
        "description": "Bundle description."
      }
    }

    In your app bundle open the file input file "input.rvt" using OpenOptions DetachAndPreserveWorksets or DetachAndDiscardWorksets.

       ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("input.rvt");
       var opts = new OpenOptions
       {
          DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets
       };
       var document = application.OpenDocumentFile(path, opts);
    

    This was covered in the my AU class (see video at 37 min mark).