锻造设计自动化:缺少输出文件

Posted

技术标签:

【中文标题】锻造设计自动化:缺少输出文件【英文标题】:Forge design automation: missing output file 【发布时间】:2020-06-09 02:45:53 【问题描述】:

我正在使用 Forge 的设计自动化 API 将 Revit 转换为 IFC 文件。在一些(重要的:不是全部)Revit 文件中,我遇到了以下问题:

model-extractor_1          | [02/25/2020 10:50:58] Running in unattended mode.
model-extractor_1          | [02/25/2020 10:50:58] ====== Revit is running: revitcoreconsole ======
model-extractor_1          | [02/25/2020 10:50:58] Current Exe path: T:\Aces\AcesRoot\19.0\coreEngine\Exe\revitcoreconsole.exe
model-extractor_1          | [02/25/2020 10:50:58] Echoing command line args:
model-extractor_1          | [02/25/2020 10:50:58]   0:/i
model-extractor_1          | [02/25/2020 10:50:58]   1:T:\Aces\Jobs\16c21feb781e44539b20f0b32384730c\5e54fbc67a40b70023fb77a7.rvt
model-extractor_1          | [02/25/2020 10:50:58]   2:/al
model-extractor_1          | [02/25/2020 10:50:58]   3:T:\Aces\Applications\04530640f3854e51106296c1bad8c4d8.RvtPreprocess.RvtPreprocess5[1].package
model-extractor_1          | [02/25/2020 10:50:58]   4:/isolate
model-extractor_1          | [02/25/2020 10:50:58]   5:HKEY_CURRENT_USER\SOFTWARE\AppDataLow\Software\Autodesk\CoreUser\WorkItem_16c21feb781e44539b20f0b32384730c
model-extractor_1          | [02/25/2020 10:50:58]   6:T:\Aces\Jobs\16c21feb781e44539b20f0b32384730c\userdata
model-extractor_1          | [02/25/2020 10:50:58] Running RevitAssemblyResolver....
model-extractor_1          | [02/25/2020 10:50:58] Initializing RevitCoreEngine...
model-extractor_1          | [02/25/2020 10:50:58] Selected Revit\RCE install Path: (from app.config) C:\Revit2019
model-extractor_1          | [02/25/2020 10:50:58] Resolving location of Revit/RevitCoreEngine installation...
model-extractor_1          | [02/25/2020 10:50:58] Running user application....
model-extractor_1          | [02/25/2020 10:51:01] Found an addIn for registration: RvtPreprocess.addin
model-extractor_1          | [02/25/2020 10:51:01] Initializing RCE....
model-extractor_1          | [02/25/2020 10:51:01] Initializing RevitCoreEngine (and possibly running stub installer)...
model-extractor_1          | [02/25/2020 10:51:01] Language not specified, using English as default
model-extractor_1          | [02/25/2020 10:51:02] Initialize and  get RCE: (VersionBuild) 19.0.0.0 (VersionNumber) 2019 (SubVersionNumber) 2019.2
model-extractor_1          | [02/25/2020 10:52:58] Finished running.  Process will return: Success
model-extractor_1          | [02/25/2020 10:52:58] ====== Revit finished running: revitcoreconsole ======
model-extractor_1          | [02/25/2020 10:53:00] End Revit Core Engine standard output dump.
model-extractor_1          | [02/25/2020 10:53:00] End script phase.
model-extractor_1          | [02/25/2020 10:53:00] Start upload phase.
model-extractor_1          | [02/25/2020 10:53:00] Error: Non-optional output [result.ifc] is missing .
model-extractor_1          | [02/25/2020 10:53:00] Error: An unexpected error happened during phase Publishing of job.
model-extractor_1          | [02/25/2020 10:53:00] Job finished with result FailedMissingOutput
model-extractor_1          | [02/25/2020 10:53:00] Job Status:

这很奇怪,因为我确保准备好上传网址。这很明显,因为某些文件确实成功了。

我的workItem 流程/代码类似于:

        const downloadUrl = (await this.dataManagementClient.createSignedUrl(this.params.forgeBucket, shortName)).signedUrl;
        const uploadUrl = (await this.dataManagementClient.createSignedUrl(this.params.forgeBucket, uuid4(), 'readwrite')).signedUrl;
        const workItem = await this.designAutomationClient.createWorkItem(
            'RvtPreprocess.RvtPreprocessActivity5+test',
            
                rvtFile: 
                    url: downloadUrl,
                    pathInZip: shortName,
                ,
                result: 
                    verb: "put",
                    url: uploadUrl
                
            
        )

有什么提示吗?

编辑:

工作信息日志:

model-extractor_1          | [02/25/2020 11:14:52] Job information:
model-extractor_1          | "CommandLine":[
model-extractor_1          |   "$(engine.path)\\\\revitcoreconsole.exe /i $(args[rvtFile].path) /al $(appbundles[RvtPreprocess5].path)"
model-extractor_1          | ]
model-extractor_1          | "Settings":
model-extractor_1          |   "dasreportfailedlimits": 
model-extractor_1          |     "value": "true",
model-extractor_1          |     "isEnvironmentVariable": true
model-extractor_1          |   
model-extractor_1          | 
model-extractor_1          | "Id":"b028fe12c5b943d48356a5738f743153"
model-extractor_1          | "ActivityId":"RvtPreprocess.RvtPreprocessActivity5+test"
model-extractor_1          | "Engine.Id":"Autodesk.Revit!29"
model-extractor_1          | "Apps": [
model-extractor_1          | "App.Id":"RvtPreprocess.RvtPreprocess5!1"
model-extractor_1          | ]
model-extractor_1          | "BoundArguments":
model-extractor_1          |   "rvtFile": 
model-extractor_1          |     "localName": "$(rvtFile)",
model-extractor_1          |     "pathInZip": "5e5501747a40b70023fb77a9.rvt",
model-extractor_1          |     "url": "https://developer.api.autodesk.com/Masked:+A9horix/Nh5wX8c2fmP0d+60CE="
model-extractor_1          |   ,
model-extractor_1          |   "result": 
model-extractor_1          |     "localName": "result.ifc",
model-extractor_1          |     "url": "https://developer.api.autodesk.com/Masked:4bpSamXnp/wNDyhX7oGp+5oCMo4=",
model-extractor_1          |     "verb": "put"
model-extractor_1          |   ,
model-extractor_1          |   "onProgress": 
model-extractor_1          |     "ondemand": true,
model-extractor_1          |     "url": "https://wlnr5sjl3a.execute-api.us-east-1.amazonaws.com/Masked:UK/Z3b5X3xUWxXiH6C9r9i9UlRU=",
model-extractor_1          |     "headers": 
model-extractor_1          |       "Content-Type": "application/json",
model-extractor_1          |       "x-das-authorize": "awssigv4(us-east-1)",
model-extractor_1          |       "x-ads-token-data": "\"access_token\":\"client_id\":\"TqUUZ0ZZFm3cK8BU8ROHdX4gt99mzkUl\",\"scope\":\"code:all\",\"expires_in\":3599,\"client_id\":\"TqUUZ0ZZFm3cK8BU8ROHdX4gt99mzkUl\""
model-extractor_1          |     ,
model-extractor_1          |     "verb": "put"
model-extractor_1          |   
model-extractor_1          | 
model-extractor_1          | "Quotas":
model-extractor_1          |   "limitDownloads": 200,
model-extractor_1          |   "limitUploads": 200,
model-extractor_1          |   "limitDownloadSizeMB": 2000,
model-extractor_1          |   "limitUploadSizeMB": 2000,
model-extractor_1          |   "limitProcessingTimeSec": 10800,
model-extractor_1          |   "limitTotalUncompressedAppsSizeInMB": 5000
model-extractor_1          | 

编辑 2:

这是一个有效翻译的示例。完全相同的流程/代码;不同的 Revit 文件:

[02/25/2020 11:58:12] ====== Revit is running: revitcoreconsole ======
[02/25/2020 11:58:12] Current Exe path: T:\Aces\AcesRoot\19.0\coreEngine\Exe\revitcoreconsole.exe
[02/25/2020 11:58:12] Echoing command line args:
[02/25/2020 11:58:12]   0:/i
[02/25/2020 11:58:12]   1:T:\Aces\Jobs\1631ee152e2248409f5ef6e0299e968a\5e550bc17a40b70023fb77ab.rvt
[02/25/2020 11:58:12]   2:/al
[02/25/2020 11:58:12]   3:T:\Aces\Applications\04530640f3854e51106296c1bad8c4d8.RvtPreprocess.RvtPreprocess5[1].package
[02/25/2020 11:58:12]   4:/isolate
[02/25/2020 11:58:12]   5:HKEY_CURRENT_USER\SOFTWARE\AppDataLow\Software\Autodesk\CoreUser\WorkItem_1631ee152e2248409f5ef6e0299e968a
[02/25/2020 11:58:12]   6:T:\Aces\Jobs\1631ee152e2248409f5ef6e0299e968a\userdata
[02/25/2020 11:58:12] Running RevitAssemblyResolver....
[02/25/2020 11:58:12] Initializing RevitCoreEngine...
[02/25/2020 11:58:12] Selected Revit\RCE install Path: (from app.config) C:\Revit2019
[02/25/2020 11:58:12] Resolving location of Revit/RevitCoreEngine installation...
[02/25/2020 11:58:12] Running user application....
[02/25/2020 11:58:16] Found an addIn for registration: RvtPreprocess.addin
[02/25/2020 11:58:16] Initializing RCE....
[02/25/2020 11:58:16] Initializing RevitCoreEngine (and possibly running stub installer)...
[02/25/2020 11:58:16] Language not specified, using English as default
[02/25/2020 11:58:17] Initialize and  get RCE: (VersionBuild) 19.0.0.0 (VersionNumber) 2019 (SubVersionNumber) 2019.2
[02/25/2020 11:58:29] Finished running.  Process will return: Success
[02/25/2020 11:58:29] ====== Revit finished running: revitcoreconsole ======
[02/25/2020 11:58:29] QWaitCondition: Destroyed while threads are still waiting
[02/25/2020 11:58:30] End Revit Core Engine standard output dump.
[02/25/2020 11:58:30] End script phase.
[02/25/2020 11:58:30] Start upload phase.
[02/25/2020 11:58:30] Uploading T:\Aces\Jobs\1631ee152e2248409f5ef6e0299e968a\result.ifc to https://developer.api.autodesk.com/oss/v2/signedresources/39644f58-8268-49ea-a945-5e8683592ebb?region=US.
[02/25/2020 11:58:30] End upload phase.
[02/25/2020 11:58:30] Job finished with result Succeeded
[02/25/2020 11:58:30] Job Status:

编辑 3:

这是写入文件的脚本中的代码 sn-p:

public static void ExportFunc(DesignAutomationData data)
    //some code
    var path_dir = Path.GetDirectoryName(data.FilePath);
    doc.Export(path_dir, "result.ifc", opt);

无论文件的内容如何,​​它似乎都足够基本,可以始终如一地工作。

会不会是这个过程是一个静默的误报,导致在 Revit 不知情的情况下没有文件可以上传?

【问题讨论】:

你能提供你的问题的工作示例吗??? @SkorpEN 请查看编辑后的帖子。 提供工作示例以简化版本显示您的问题,增加找到正确答案的机会。最理想的是重现错误的数据。它可以是托管在某处的项目或 git 地址。它可以是没有凭据的简化版本。 您拥有完整的workItem 创建代码。这已经足够了(唯一缺少的变量是shortName)。显然我不能上传不同的图纸,因为它们是非常专有的。 【参考方案1】:

发生此错误是因为当您的工作项达到上传阶段(一旦 Revit 完成执行)时没有名为“result.ifc”的文件。由于您为此文件定义了非可选输出,因此您的工作项错误地完成了。 下一步是调试您的 addIn/workitem 代码,以确保始终在正确的位置生成 result.ifc 文件。

【讨论】:

这与只有部分绘图失败的事实有何关系? “当您的工作项到达上传阶段时(一旦 Revit 执行完毕),没有名为“result.ifc”的文件。”也似乎是矛盾的,因为 Revit 只能在创建“result.ifc”之后才能执行。 这种情况会发生吗,例如,如果底层脚本失败,Revit 不知道失败,将作业的状态设置为完成? (导致上传失败,因为确实没有文件生成) 有可能,我对 Revit 的了解非常有限(抱歉)。我不太确定是什么可能导致 Revit 不生成文件,但脚本中的故障似乎是一个很好的嫌疑人。 @leongold - 没有足够的信息让我查明问题。由于代码适用于某些文件而不适用于某些文件,我怀疑这些输入文件的导出可能会失败。您可以打印导出的状态,如下所示,它们将显示在您的日志中: ``` public static void ExportFunc(DesignAutomationData data) //some code var path_dir = Path.GetDirectoryName(data.FilePath); var result = doc.Export(path_dir, "result.ifc", opt); Console.WriteLine($"导出结果 = result"); ``` 你也可以尝试在本地调试你的插件:forge.autodesk.com/blog/…

以上是关于锻造设计自动化:缺少输出文件的主要内容,如果未能解决你的问题,请参考以下文章

什么情况下用压铸,什么情况下用锻造,什么情况下用数控机床?

将我的设计自动化输出保存为 .zip 文件以保留材料纹理

在 Forge Viewer 中显示设计自动化 API 的输出

如何在设计自动化 api 中为 revit 创建多个文件并将结果下载为一个 zip 文件

欧特克设计自动化

Autodesk 设计自动化活动:如何区分输入和输出参数