导出后自动恢复剖面盒(Navisworks ExportToNwd 内部关闭剖分)
- SectionClipHelper 新增 RestoreClipBox 公开方法 - VisibilityHelper.ExecuteWithPrecomputedHiddenItems 导出前保存剖面盒状态,导出后恢复
This commit is contained in:
parent
47af2443cd
commit
e5f710407c
@ -246,6 +246,14 @@ namespace NavisworksTransport.Utils
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 恢复剖面盒(用于被 Navisworks ExportToNwd 内部关闭后重新启用)
|
||||
/// </summary>
|
||||
public static void RestoreClipBox(BoundingBox3D box)
|
||||
{
|
||||
ApplyClipBox(box);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前剖面盒
|
||||
/// </summary>
|
||||
|
||||
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Autodesk.Navisworks.Api;
|
||||
using NavisworksTransport.Utils;
|
||||
using NavisApplication = Autodesk.Navisworks.Api.Application;
|
||||
|
||||
namespace NavisworksTransport
|
||||
@ -261,9 +262,14 @@ namespace NavisworksTransport
|
||||
return default(T);
|
||||
}
|
||||
|
||||
// 保存当前状态
|
||||
// 保存可见性状态
|
||||
var savedState = SaveVisibilityStateInternal(document);
|
||||
|
||||
// 保存剖面盒状态(Navisworks ExportToNwd 会内部关闭剖分)
|
||||
bool clipWasEnabled = SectionClipHelper.IsClipBoxEnabled;
|
||||
BoundingBox3D savedClipBox = default;
|
||||
bool hasClipBox = SectionClipHelper.TryGetCurrentClipBox(out savedClipBox);
|
||||
|
||||
try
|
||||
{
|
||||
// 1. 全部显示
|
||||
@ -281,8 +287,14 @@ namespace NavisworksTransport
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 4. 恢复状态
|
||||
// 4. 恢复可见性状态
|
||||
RestoreVisibilityStateInternal(document, savedState);
|
||||
|
||||
// 5. 恢复剖面盒(Navisworks 导出时会关闭)
|
||||
if (clipWasEnabled && !SectionClipHelper.IsClipBoxEnabled && hasClipBox)
|
||||
{
|
||||
SectionClipHelper.RestoreClipBox(savedClipBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user