本文介绍了Revit 输出压缩文件的设计自动化为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to export 3d views from the Revit model to 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).

我以这篇文章为例: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] 日志:3d 视图的总量Autodesk.Revit.DB.文件路径:22[02/05/2021 18:17:21] 日志:3dViews 到出口:2[02/05/2021 18:17:25] Log ARK IFC-ekport 出口:真[02/05/2021 18:17:26] Log ARK IFC-ekport emty 导出:True[02/05/2021 18:17:26] 日志:要导出的 3dViews:2.成功:2.失败:0

[02/05/2021 18:17:31] 进入finishPlayback .. destroym_PlaybackState

[02/05/2021 18:17:31] entering finishPlayback .. destroym_PlaybackState

继续finishPlayback .. 销毁callStream()

continuing finishPlayback .. destroy callStream()

退出finishPlayback

exited finishPlayback

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

[02/05/2021 18:17:31] Finished running. Process will return: Success

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

[02/05/2021 18:17:34] Zipping directoryT:AcesJobs18ff2cb40e7944e8a41b4f8c6360e493esult asT:AcesJobs18ff2cb40e7944e8a41b4f8c6360e493esult.zip. [02/05/202118:17:34] Uploading'T:AcesJobs18ff2cb40e7944e8a41b4f8c6360e493esult.zip': verb -'PUT', url -'https://developer.api.autodesk.com/oss/v2/buckets/ifc_export_external/objects/000001-01Test 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,bytesUploaded":22

"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

更新

打开用户的工作集可能有问题.当我在本地调试时,导出结果取决于我如何打开我的工作集.如果我打开所有用户工作集,导出看起来很棒,如果我关闭所有工作集,我得到的 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);

但我收到错误消息:您应该登录 A360 才能执行此操作."

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

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

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

This example uses : uidoc.ShowElements(ElementId), but uidoc is part of UI component, so it is not supporrted by DA4R.

更新

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

I've logged all worksets, all of them are opened and vissible by default.

我该如何解决问题?

推荐答案

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

In my case, the problem was caused by the IFCExportOptions

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

当我将其设置为false"时,输出不为空.

When I set it to "false", output was not empty.

顺便说一下,在本地调试中,它适用于两个选项.

这篇关于Revit 输出压缩文件的设计自动化为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 07:12