【问题标题】:Design Automation for Revit output zipped file is emptyRevit 输出压缩文件的设计自动化为空
【发布时间】:2021-05-10 03:02:47
【问题描述】:

我正在尝试将 3d 视图从 Revit 模型导出到 IFC。 当我在本地运行我的插件时,它运行良好,并且在 DA4R 中的日志也是正确的,但是导出的结果是 22bytes(空 zip)。

我以这篇文章为例:https://forge.autodesk.com/blog/how-generate-dynamic-number-output-design-automation-revit-v3

这是我的活动:

{
"commandLine": [
    "$(engine.path)\\\\revitcoreconsole.exe  /al \"$(appbundles[ExportIfcFromZippedApp].path)\""
],
"parameters": {
    "inputFile": {
        "zip":true,
        "verb": "get",
        "description": "Input Revit model(zipped)",
        "required": true,
        "localName":"input"    
    },
"inputModelName":{
    "verb":"get",
     "description": "Additional parameters like : ModelName",
     "localName":"additionalParams.json"
},
    "inputJson": {
        "verb": "get",
        "description": "IFC Export Options",
        "localName": "params.json"
    },
    "outputFile": {
        "zip": true,
        "verb": "put",
        "description": "Ouput IFC views",
        "required": true,
        "localName": "result"
    }
},

这是我的出口

                    if (RuntimeValue.RunOnCloud)
                {
                    try
                    {
                        var res = doc.Export(Directory.GetCurrentDirectory() + "\\result", item.Name, exportOptions);
                        Console.WriteLine($"Log {item.Name} exported:{res}");
                        successItems++;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Log: Error in exporting {item.Name} view from {modelPath}");
                        Console.WriteLine($"{ex.Message}, {ex.Source}");
                        failureItems++;
                    }
                }

控制台输出:

[02/05/2021 18:17:21] 日志:在 Autodesk.Revit.DB.FilePath:22 [02/05/2021 18:17:21] 日志:3dViews 到 出口:2 [02/05/2021 18:17:25] 导出 ARK IFC-ekport 日志:True [02/05/2021 18:17:26] 导出 ARK IFC-ekport emty 日志:True [02/05/2021 18:17:26] 日志:要导出的 3dViews:2。成功:2。失败:0

[02/05/2021 18:17:31] 进入 finishPlayback .. 销毁 m_PlaybackState

继续完成播放 .. 销毁 callStream()

退出完成播放

[02/05/2021 18:17:31] 运行完毕。进程将返回:成功

[02/05/2021 18:17:34] 压缩目录 T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\结果为 T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.zip。 [02/05/2021 18:17:34] 上传 'T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.zip':动词 - 'PUT',网址 - 'https://developer.api.autodesk.com/oss/v2/buckets/ifc_export_external/objects/000001-01 测试 Autoifc ARK.zip'

“统计”:{ "timeQueued": "2021-02-05T18:14:17.0325708Z", "timeDownloadStarted": "2021-02-05T18:14:17.314204Z", "timeInstructionsStarted": "2021-02-05T18:14:21.7983855Z", "timeInstructionsEnded": "2021-02-05T18:17:34.7014528Z", "timeUploadEnded": "2021-02-05T18:17:34.9939046Z", “字节下载”:88722885, “字节上传”:22

更新

这可能是打开用户工作集的问题。当我在本地调试它时,导出结果取决于我如何打开我的工作集。如果我打开所有用户工作集,导出看起来很棒,如果我关闭所有工作集,我会得到非常小的 ifc 文件,但它们不是空的,就像在 DA4R 中一样。

我在我的插件中使用这个:

var openOptions = new OpenOptions();

  openOptions.DetachFromCentralOption = 
      DetachFromCentralOption.DetachAndPreserveWorksets;

  Console.WriteLine($"Log : DetachAndPreserveWorksets,");

  WorksetConfiguration openConfig = new 
  WorksetConfiguration(WorksetConfigurationOption.OpenAllWorksets);

  openOptions.SetOpenWorksetsConfiguration(openConfig);

  Document doc = rvtApp.OpenDocumentFile(modelPath, openOptions);

我已经尝试获取用户工作集信息

IList<WorksetPreview> worksets = WorksharingUtils.GetUserWorksetInfo(modelPath);

但我收到一个错误:“您应该登录到 A360 才能执行此操作。”

我还找到了在文档打开时打开工作集的解决方案: https://forums.autodesk.com/t5/revit-api-forum/open-closed-worksets-in-open-document/td-p/6238121

本例使用:uidoc.ShowElements(ElementId),但uidoc是UI组件的一部分,DA4R不支持。

更新

我已经记录了所有工作集,默认情况下所有工作集都是打开且可见的。

我该如何解决这个问题?

【问题讨论】:

  • 根据我的阅读,文件夹中的输出可能只是空的。我们无法检查里面有什么,因为工作完成后总是会清理工作文件夹。在我们压缩和上传之前,您能否尝试在您的插件中添加更多日志以查看文件夹中是否有文件(例如文件大小)作为导出结果?
  • 我尝试在结果目录中记录文件,但出现错误
  • 你有什么错误?您还可以提供记录错误的 WorkItem Id 吗?
  • 这里是 id:18ff2cb40e7944e8a41b4f8c6360e493。甚至都不是错误,Logging 被忽略
  • 要登录 DA,请尝试使用 Trace.TraceInformationTrace.TraceError 而不是 Console.WriteLine(在 DA 4 Inventor 中,我使用它并且日志记录工作完美)

标签: autodesk-forge autodesk-designautomation


【解决方案1】:

就我而言,问题是由 IFCExportOptions 引起的

options.AddOption("ExportSchedulesAsPsets","true")

当我将它设置为“false”时,输出不为空。

顺便说一下,在本地调试时,它可以同时使用这两个选项。

【讨论】:

    猜你喜欢
    • 2020-08-07
    • 2021-09-03
    • 2021-06-29
    • 1970-01-01
    • 1970-01-01
    • 2020-04-22
    • 2020-06-09
    • 2022-11-16
    • 2020-05-06
    相关资源
    最近更新 更多