Design Automation for Revit 输出压缩文件为空

Design Automation for Revit output zipped file is empty

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

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

这是我的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"
    }
},

这是我的导出

                    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] 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. Failure: 0

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

continuing finishPlayback .. destroy callStream()

exited finishPlayback

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

[02/05/2021 18:17:34] Zipping directory T:\Aces\Jobsff2cb40e7944e8a41b4f8c6360e493\result as T:\Aces\Jobsff2cb40e7944e8a41b4f8c6360e493\result.zip. [02/05/2021 18:17:34] Uploading 'T:\Aces\Jobsff2cb40e7944e8a41b4f8c6360e493\result.zip': verb - 'PUT', url - 'https://developer.api.autodesk.com/oss/v2/buckets/ifc_export_external/objects/000001-01 Test 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

更新

打开用户工作集可能有问题。当我在本地调试它时,导出结果取决于我打开工作集的方式。如果我打开所有用户工作集,导出看起来不错,如果我关闭所有工作集,我得到非常小的 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 不支持它。

更新

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

我该如何解决这个问题?

就我而言,问题是由 IFCExportOptions

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

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

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