Search code examples
autodesk-forgeautodesk-designautomation

APS Design Automation - Open Revit Cloud Models


I am trying to follow this Blog Post to adapt Design Automation to support access to Revit Cloud Models

link to Blog

My question is how to adapt commandLine to not include rvtFile, since it will be opened by inputJson info (projectGuid/modelGuid). Simply suppress it from the command and from parameters list? Is the data body bellow correct?

{
            "id": "UpdateParametersActivity",
            "commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /al \"$(appbundles[DA_UpdateParameters].path)\"" ],
            "parameters": {
              "inputJson": { 
                  "verb": "get",
                  "description":"input json", 
                  "localName":"params.json",
                  "ondemand": false, 
                  "required" :false, 
                  "zip": false 
              }
            },
            "engine": "Autodesk.Revit+2022",
            "appbundles": [ "ME_BimViewer_DES.DA_UpdateParameters+test" ],
            "description": "Update Parameters from Revit file."
    }

Solution

  • Yes, skipping the /i argument in the command line allows you to not have a document opened by DA for you. Your command line is correct, did you try it?

    "commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /al \"$(appbundles[DA_UpdateParameters].path)\"" ],
    

    You will have to open the document yourself using:

    var cloudModelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(inputParams.Region, inputParams.ProjectGuid, inputParams.ModelGuid);
    Document doc = rvtApp.OpenDocumentFile(cloudModelPath, new OpenOptions());