[英]Design Automation for Revit output zipped file is empty
我正在嘗試將 3d 視圖從 Revit model 導出到 IFC。 當我在本地運行我的插件時,它運行良好,並且 DA4R 中的日志也是正確的,但導出的結果是 22 字節(空 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++;
}
}
控制台 output:
[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。 失敗: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\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 測試 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
更新
打開用戶的工作集可能有問題。 當我在本地調試它時,導出結果取決於我如何打開我的工作集。 如果我打開所有用戶工作集,導出看起來很棒,如果我關閉所有工作集,我會得到非常小的 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”時,output 不為空。
順便說一句,在本地調試中,它可以同時使用這兩個選項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.