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

问题描述

我正在尝试将Revit模型中的3d视图导出到IFC.当我在本地运行插件时,它运行良好,并且DA4R中的登录记录也正确,但是导出的结果是22bytes(空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:31]进入finishPlayback ..销毁m_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:\ Aces \ Jobs \ 18ff2cb40e7944e8a41b4f8c6360e493 \结果为T:\ Aces \ Jobs \ 18ff2cb40e7944e8a41b4f8c6360e493 \ result.zip.[02/05/202118: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'

[02/05/2021 18:17:34] Zipping directoryT:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result asT:\Aces\Jobs\18ff2cb40e7944e8a41b4f8c6360e493\result.zip. [02/05/202118: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-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","bytesDownloaded":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中一样.

我在插件中使用了它

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-worksets-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输出的Design Automation压缩文件为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 20:03