简体   繁体   English

Revit output 压缩文件的设计自动化为空

[英]Design Automation for Revit output zipped file is empty

I am trying to export 3d views from the Revit model to IFC.我正在尝试将 3d 视图从 Revit model 导出到 IFC。 When I run my plugin locally, it works perfectly, and logs in DA4R are correct too, but the result of exporting is 22bytes(empty zip).当我在本地运行我的插件时,它运行良好,并且 DA4R 中的日志也是正确的,但导出的结果是 22 字节(空 zip)。

I've used this article as an example: https://forge.autodesk.com/blog/how-generate-dynamic-number-output-design-automation-revit-v3我以这篇文章为例: https://forge.autodesk.com/blog/how-generate-dynamic-number-output-design-automation-revit-v3

Here is my activity:这是我的活动:

{
"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"
    }
},

Here is my Export这是我的出口

                    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++;
                    }
                }

Console output:控制台 output:

[02/05/2021 18:17:21] Log: Total amount of 3d Views in the Autodesk.Revit.DB.FilePath: 22 [02/05/2021 18:17:21] Log: 3dViews to export: 2 [02/05/2021 18:17:25] Log ARK IFC-ekport exported:True [02/05/2021 18:17:26] Log ARK IFC-ekport emty exported:True [02/05/2021 18:17:26] Log: 3dViews to export: 2. Success:2. [02/05/2021 18:17:21] 日志:Autodesk.Revit.DB.FilePath 中 3d 视图的总量:22 [02/05/2021 18:17:21] 日志:要导出的 3dViews:2 [ 2021 年 2 月 5 日 18:17:25] 导出 ARK IFC-ekport 的日志:True [02/05/2021 18:17:26] 导出 ARK IFC-ekport 的日志:True [02/05/2021 18:17: 26] 日志:要导出的 3dViews:2。成功:2。 Failure: 0失败:0

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

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

exited finishPlayback退出完成播放

[02/05/2021 18:17:31] Finished running. [02/05/2021 18:17:31] 运行完毕。 Process will return: Success进程将返回:成功

[02/05/2021 18:17:34] Zipping directory T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result as T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.zip. [02/05/2021 18:17:34] 压缩目录 T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result 为 T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.ZADCDBD2Z9A8D8A4175C [02/05/2021 18:17:34] Uploading 'T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.zip': verb - 'PUT', url - 'https://developer.api.autodesk.com/oss/v2/buckets/ifc_export_external/objects/000001-01 Test Autoifc ARK.zip' [02/05/2021 18:17:34] Uploading 'T:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.zip': verb - 'PUT', url - 'https://developer.api.autodesk.com/oss /v2/buckets/ifc_export_external/objects/000001-01 测试 Autoifc ARK.zip'

"stats": { "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", "bytesDownloaded": 88722885, "bytesUploaded": 22 “统计”:{“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”、“bytesDownloaded”:88722885、“bytesUploaded”: 22

UPDATE更新

It might be a problem with openning Users's Worksets.打开用户的工作集可能有问题。 When i debug it localy, export result depends how i open my worksets.当我在本地调试它时,导出结果取决于我如何打开我的工作集。 If I open all user worksets, export looks great, if i close all worksets, i am getting very small ifc files, but they are not empty, like in DA4R.如果我打开所有用户工作集,导出看起来很棒,如果我关闭所有工作集,我会得到非常小的 ifc 文件,但它们不是空的,就像在 DA4R 中一样。

I use this in my plugin:我在我的插件中使用它:

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);

I've tried to do get User Workset Info我已经尝试获取用户工作集信息

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

But i am getting an Error: "You shoul be Logged in to A360 to do that."但我收到一个错误:“您应该登录到 A360 才能执行此操作。”

Also i found a solution to open worksets when the document is open: https://forums.autodesk.com/t5/revit-api-forum/open-closed-worksets-in-open-document/td-p/6238121我还找到了打开文档时打开工作集的解决方案: https://forums.autodesk.com/t5/revit-api-forum/open-closed-worksets-in-open-document/td-p/6238121

This example uses: uidoc.ShowElements(ElementId) , but uidoc is part of UI component, so it is not supporrted by DA4R.此示例使用: uidoc.ShowElements(ElementId) ,但 uidoc 是 UI 组件的一部分,因此不受 DA4R 支持。

UPDATE更新

I've logged all worksets, all of them are opened and vissible by default.我已经记录了所有工作集,默认情况下所有这些工作集都是打开且可见的。

How can I sort out the problem?我该如何解决问题?

In my case, the problem was caused by the IFCExportOptions就我而言,问题是由 IFCExportOptions 引起的

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

When I set it to "false", output was not empty.当我将其设置为“false”时,output 不为空。

By the way, on local debug, it worked with both options.顺便说一句,在本地调试中,它可以同时使用这两个选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM