0

I'm trying to use Forge's Design Automation API to auto-place certain model line geometries in my Revit model. I successfully follow the tutorial on the Autodesk's documentation, but when I submit a workitem, I encounter this error message. Can anyone help me with this?

"CommandLine":[
  "$(engine.path)\\\\revitcoreconsole.exe /i \"$(args[rvtFile].path)\" /al \"$(appbundles[PropGenerate].path)\""
]
"Settings":{
  "dasreportfaileduploadoptional": {
    "value": "true",
    "isEnvironmentVariable": true
  }
}
"Id":"8028b869feac4e8b9cc24c54a89e40ef"
"ActivityId":"cottage_bim_da.PropGenerateActivity+test"
"Engine.Id":"Autodesk.Revit!75"
"Apps": [
"App.Id":"cottage_bim_da.PropGenerate!3"
]
"BoundArguments":{
  "rvtFile": {
    "localName": "$(rvtFile)",
    "url": "https://developer.api.autodesk.com/Masked:zn8gkB/+dq7DcaiQvFFcQoZJaqw="
  },
  "result": {
    "localName": "result.rvt",
    "url": "https://developer.api.autodesk.com/Masked:Hhq8V5ffHZZ3IXpN0jG8Qt/0qeA=",
    "verb": "put"
  },
  "onComplete": {
    "ondemand": true,
    "optional": true,
    "url": "https://hooks.slack.com/Masked:9J3dSku5M9F2V+1rVNWikLcxp3M=",
    "verb": "post"
  },
  "onProgress": {
    "ondemand": true,
    "url": "https://wlnr5sjl3a.execute-api.us-east-1.amazonaws.com/Masked:UK/Z3b5X3xUWxXiH6C9r9i9UlRU=",
    "headers": {
      "Content-Type": "application/json",
      "x-das-authorize": "awssigv4(us-east-1)",
      "x-ads-token-data": "{\"access_token\":{\"client_id\":\"EMGeKroATulgTmGwP2IiWznEGg4PI1np\"},\"scope\":\"code:all data:write data:read bucket:create bucket:delete\",\"expires_in\":3415,\"client_id\":\"EMGeKroATulgTmGwP2IiWznEGg4PI1np\"}",
      "x-ads-gateway-secret": "B8D93ECCBBCCEA74BD9EF64423B1C6FC"
    },
    "verb": "put"
  }
}
"Quotas":{
  "limitProcessingTimeSec": 10800,
  "limitTotalUncompressedAppsSizeInMB": 5000
}
[01/05/2022 13:30:01] Starting work item 8028b869feac4e8b9cc24c54a89e40ef
[01/05/2022 13:30:01] Start download phase.
[01/05/2022 13:30:01] Start downloading input: verb - 'GET', url - 'https://developer.api.autodesk.com/oss/v2/signedresources/e58be8a5-9d67-4176-b1d1-14fe331a5d3d?region=US'
[01/05/2022 13:30:02] '20185088' bytes have been written to T:\Aces\Jobs\8028b869feac4e8b9cc24c54a89e40ef\template_rvt_model.
[01/05/2022 13:30:02] End downloading file from 'https://developer.api.autodesk.com/oss/v2/signedresources/e58be8a5-9d67-4176-b1d1-14fe331a5d3d?region=US'.
[01/05/2022 13:30:02] End download phase successfully.
[01/05/2022 13:30:02] Start preparing script and command line parameters.
[01/05/2022 13:30:02] Command line: [ /i "T:\Aces\Jobs\8028b869feac4e8b9cc24c54a89e40ef\template_rvt_model" /al "T:\Aces\Applications\25fb6f2a218d055543f2acf3656f6a81.cottage_bim_da.PropGenerate[3].package"]
[01/05/2022 13:30:02] End preparing script and command line parameters.
[01/05/2022 13:30:02] Start script phase.
[01/05/2022 13:30:02] Start Revit Core Engine standard output dump.
[01/05/2022 13:30:03] Running in unattended mode.
[01/05/2022 13:30:03] ====== Revit is running: revitcoreconsole ======
[01/05/2022 13:30:03] Current Exe path: T:\Aces\AcesRoot\21.0\coreEngine\Exe\revitcoreconsole.exe
[01/05/2022 13:30:03] Echoing command line args:
[01/05/2022 13:30:03]   0:/i
[01/05/2022 13:30:03]   1:T:\Aces\Jobs\8028b869feac4e8b9cc24c54a89e40ef\template_rvt_model
[01/05/2022 13:30:03]   2:/al
[01/05/2022 13:30:03]   3:T:\Aces\Applications\25fb6f2a218d055543f2acf3656f6a81.cottage_bim_da.PropGenerate[3].package
[01/05/2022 13:30:03]   4:/isolate
[01/05/2022 13:30:03]   5:HKEY_CURRENT_USER\SOFTWARE\AppDataLow\Software\Autodesk\CoreUser\WorkItem_8028b869feac4e8b9cc24c54a89e40ef
[01/05/2022 13:30:03]   6:T:\Aces\Jobs\8028b869feac4e8b9cc24c54a89e40ef\userdata
[01/05/2022 13:30:03] Running RevitAssemblyResolver....
[01/05/2022 13:30:03] Initializing RevitCoreEngine...
[01/05/2022 13:30:03] Selected Revit\RCE install Path: (from app.config) C:\Revit2021
[01/05/2022 13:30:03] Resolving location of Revit/RevitCoreEngine installation...
[01/05/2022 13:30:03] Running user application....
[01/05/2022 13:30:07] Found an addIn for registration: PropGenerate.addin
[01/05/2022 13:30:07] Initializing RCE....
[01/05/2022 13:30:07] Initializing RevitCoreEngine (and possibly running stub installer)...
[01/05/2022 13:30:07] Language not specified, using English-United States(ENU) as default.
[01/05/2022 13:30:10] Initialize and  get RCE: (VersionBuild) 21.1.30.74 (VersionNumber) 2021 (SubVersionNumber) 2021.2
[01/05/2022 13:30:10] Autodesk.Revit.Exceptions.InvalidOperationException: The document can not be opened.
[01/05/2022 13:30:10]    at Autodesk.Revit.ApplicationServices.Application.OpenDocumentFile(ModelPath modelPath, OpenOptions openOptions)
[01/05/2022 13:30:10]    at DesignAutomationFramework.DesignAutomationData..ctor(Application revitApp, String mainModelPath)
[01/05/2022 13:30:10]    at DesignAutomationFramework.DesignAutomationReadyEventArgs..ctor(Application revitApp, String mainModelPath)
[01/05/2022 13:30:10]    at DesignAutomationFramework.DesignAutomationBridge.SetDesignAutomationReady(Application revitApp, String mainModelPath)
[01/05/2022 13:30:10]    at RevitCoreEngineTest.RceConsoleApplication.Program.UserMain(CommandLineArgs cl)
[01/05/2022 13:30:16] RESULT: Failure - Result of running user app is failure
[01/05/2022 13:30:16] Finished running.  Process will return: TestError
[01/05/2022 13:30:16] ====== Revit finished running: revitcoreconsole ======
[01/05/2022 13:30:17] End Revit Core Engine standard output dump.
[01/05/2022 13:30:17] Error: Application revitcoreconsole.exe exits with code 4 which indicates an error.
[01/05/2022 13:30:17] End script phase.
[01/05/2022 13:30:18] Error: An unexpected error happened during phase CoreEngineExecution of job.
[01/05/2022 13:30:18] Job finished with result FailedExecution
[01/05/2022 13:30:18] Job Status:
{
  "status": "failedInstructions",
  "reportUrl": "https://dasprod-store.s3.amazonaws.com/workItem/cottage_bim_da/8028b869feac4e8b9cc24c54a89e40ef/report.txt?AWSAccessKeyId=ASIATGVJZKM3P2XYAJCU&Expires=1641438001&x-amz-security-token=IQoJb3JpZ2luX2VjEIb%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIBFxAk5bBR55hEe7%2F00ieRjl65xyRpZCe6SKLmPvwYNSAiEAsPt%2BScc6SpRCDg3r2VPzEW6dGp8McDOeDtwPKBLkL0cqpAIIj%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARADGgwyMjA0NzMxNTIzMTAiDHCOBQgxf7eDdRYPtyr4AWMXNwXNfkeP8BPBpeNnGvWCmAyLsR0gGGa23e3W5B8sqUyl64XRqjHrYsCUsr3N7TsEt64jMh%2FaBd%2BN3vF31gS2Eu68hH81XfkBJ5PKCCQEnBwwk8ILl2uyCI73URxBbRfffdgPivSpYN8VAYSfpFZh199pynYxYi2JVeBqpec3904b4u76iIF%2BONOvf95NZYQHkfGMfLMoUAaemNEO8H%2BZnz4ZkctEstQIGa7uOskL9JKJcOPwJ1xchNxpsC3DGyKxK53WE4rdxyx6y0VY3PnnPwdT2kttQZjJZO7SL%2BgyRe9qD1GWq0%2Fu3Eb3ceEh3LccEat9UrTNMNu51o4GOpoBQECjtzWlgIAjlgtGhLUmXDsfda7u9mP2MrHIYTZdlgQA8WJnzCR29%2FJtK5DhyvwXymr3dtCOuBpbhcN%2BGPSe9CftPBnbWihvyyIfdhmduRC0VodqNXh1NZYYw2kzobvfGywz8PudOPE3cn%2FxDQ9Z0dJGCwj%2BwtwuCZB1zN3LlGW47Xjn9wbw3hHyFRA6CoYXawxZspr0cEteuw%3D%3D&Signature=ARSd%2BZtXJsOmxOYOUq2uH4eo0mM%3D",
  "stats": {
    "timeQueued": "2022-01-05T13:30:01.1704611Z",
    "timeDownloadStarted": "2022-01-05T13:30:01.3010679Z",
    "timeInstructionsStarted": "2022-01-05T13:30:02.1720008Z",
    "timeInstructionsEnded": "2022-01-05T13:30:18.0684293Z",
    "bytesDownloaded": 20185088
  },
  "id": "8028b869feac4e8b9cc24c54a89e40ef"
}

FYI, I'm also attaching my C# code below which I suspect is where the error message is coming from.

[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]

public class DaApp : IExternalDBApplication
{
    public ExternalDBApplicationResult OnStartup(Autodesk.Revit.ApplicationServices.ControlledApplication app)
    {
        DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent;
        return ExternalDBApplicationResult.Succeeded;
    }

    public ExternalDBApplicationResult OnShutdown(Autodesk.Revit.ApplicationServices.ControlledApplication app)
    {
        return ExternalDBApplicationResult.Succeeded;
    }

    public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e)
    {
        e.Succeeded = true;
        GenerateModelLines(e.DesignAutomationData);
    }


    public static void GenerateModelLines(DesignAutomationData data)
    {
        if (data == null) throw new ArgumentNullException(nameof(data));

        Application rvtApp = data.RevitApp;
        if (rvtApp == null) throw new InvalidDataException(nameof(rvtApp));

        string modelPath = data.FilePath;
        if (String.IsNullOrWhiteSpace(modelPath)) throw new InvalidDataException(nameof(modelPath));

        Document doc = data.RevitDoc;
        if (doc == null) throw new InvalidOperationException("Could not open document.");

Yongjoon Kim
  • 107
  • 1
  • 8
  • Could you post the entire log file? There might be a clue in how the command line got interpreted. – Rahul Bhobe Jan 07 '22 at 14:02
  • @Yongjoon Kim, did you ever try opening the input model in Desktop Revit(with the same version as used in Design Automation for Revit)? Does it succeed? Also please provide Workitem ID. Thanks. – Emma Zhu Jan 07 '22 at 16:58
  • Hi @EmmaZhu, thanks for the response. Yes, the Revit version was matching between the source model and the DA4R setting (R2021). And FYI, the workitem ID is 8028b869feac4e8b9cc24c54a89e40ef. Thank you. – Yongjoon Kim Jan 10 '22 at 15:33
  • Hi @RahulBhobe, I've edited the original post to include the whole log file. – Yongjoon Kim Jan 10 '22 at 15:37
  • @YongjoonKim - sorry for adding contradicting comment. But please do not post entire log. I'd suggest using forge.help@autodesk.com if you need to. I strongly suggest removing log in public. – Mikako Harada Jan 10 '22 at 21:44

3 Answers3

0

Based on the current activity/workitem definition, the command line tried to expand to

/i T:\Aces\Jobs\8028b869feac4e8b9cc24c54a89e40ef\template_rvt_model /al :T:\Aces\Applications\25fb6f2a218d055543f2acf3656f6a81.cottage_bim_da.PropGenerate[3].package

See lines in the log:

[01/05/2022 13:30:02] '20185088' bytes have been written to T:\Aces\Jobs\8028b869feac4e8b9cc24c54a89e40ef\template_rvt_model.

.
.

[01/05/2022 13:30:03] Echoing command line args:
[01/05/2022 13:30:03]   0:/i
[01/05/2022 13:30:03]   1:T:\Aces\Jobs\8028b869feac4e8b9cc24c54a89e40ef\template_rvt_model
[01/05/2022 13:30:03]   2:/al
[01/05/2022 13:30:03]   3:T:\Aces\Applications\25fb6f2a218d055543f2acf3656f6a81.cottage_bim_da.PropGenerate[3].package

This essentially causes Revit engine to attempt to open the template_rvt_model , where file path to a Revit file with extension .rvt is expected. Which explains why you see InvalidOperationException.

There could be 2 reasons for this problem...

  1. You uploaded the file to OSS yourself but did not provide the file extension to the object name. In this case the solution is simple you may reupload the file and provide the extension name like so template_rvt_model.rvt. You may also checkout our Postman samples.

  2. Or you are using BIM 360 and you ran into this rare case scenario described in this link, where the input is downloaded as a zip package. This essentially causes Revit engine to attempt to open the folder, where file path to a Revit file is expected. In order to provide the file name instead of folder, you may use the pathInZip parameter in the workitem. Also see answer 1 and answer 2.

Rahul Bhobe
  • 4,165
  • 4
  • 17
  • 32
0

You probably should try downloading the input from the url provided for the argument of rvtFile in the WorkItem payload to see what exactly Design Automation API works on. Also, you could try to define a localname as, e.g. input.rvt, instead of $(rvtFile) for the argument of rvtFile in the WorkItem payload, so the input file will be saved as .rvt explicitly by Design Automation service in case that a .rvt model is indeed uploaded to the cloud storage(where Design Automation downloads the input from), but missing the file extension.

Emma Zhu
  • 220
  • 2
  • 6
0

In my case, when dealing with workshared files, the default activity input was just not working, giving me the same error.

The solution: https://stackoverflow.com/a/66269948/12715651

This answer helped me to solve it: ditch the /i input argument, and open the model in c# from code.

Andras
  • 43
  • 6
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31301120) – MD. RAKIB HASAN Mar 18 '22 at 11:09