增加切换线框模式的功能(实验性)

This commit is contained in:
tian 2026-01-28 21:47:52 +08:00
parent eeade5553f
commit 4aa62864f3
3 changed files with 54 additions and 0 deletions

View File

@ -2,6 +2,10 @@
## 功能点
### [2026/1/28]
1. [ ] 优化将ViewPonit的RenderStyle改成Shaded以免影响高亮考虑在显示碰撞时改成Wireframe
### [2026/1/26]
1. [x] 优化完善碰撞报告截图保存机制自动导出html报告。

View File

@ -801,6 +801,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
public ICommand ClearManualHighlightsCommand { get; private set; }
public ICommand HighlightPrecomputedCollisionResultsCommand { get; private set; }
public ICommand ClearPrecomputedCollisionHighlightsCommand { get; private set; }
public ICommand ToggleWireframeModeCommand { get; private set; }
public ICommand HighlightClashDetectiveResultsCommand { get; private set; }
public ICommand ClearClashDetectiveHighlightsCommand { get; private set; }
@ -967,6 +968,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
ClearManualHighlightsCommand = new RelayCommand(ExecuteClearManualHighlights, () => HasManualCollisionTargets);
HighlightPrecomputedCollisionResultsCommand = new RelayCommand(ExecuteHighlightPrecomputedCollisionResults, () => HasClashDetectiveResults);
ClearPrecomputedCollisionHighlightsCommand = new RelayCommand(ExecuteClearPrecomputedCollisionHighlights, () => HasClashDetectiveResults);
ToggleWireframeModeCommand = new RelayCommand(ExecuteToggleWireframeMode);
HighlightClashDetectiveResultsCommand = new RelayCommand(ExecuteHighlightClashDetectiveResults, () => HasClashDetectiveResults);
ClearClashDetectiveHighlightsCommand = new RelayCommand(ExecuteClearClashDetectiveHighlights, () => HasClashDetectiveResults);
RefreshClashDetectiveResultsCommand = new RelayCommand(ExecuteRefreshClashDetectiveResults);
@ -2018,6 +2020,51 @@ namespace NavisworksTransport.UI.WPF.ViewModels
UpdateMainStatus("已清除预计算碰撞结果高亮");
}
private void ExecuteToggleWireframeMode()
{
try
{
var doc = Application.ActiveDocument;
if (doc == null || doc.IsClear)
{
LogManager.Warning("[线框模式] 没有活动的文档");
UpdateMainStatus("无法切换线框模式:没有活动文档");
return;
}
// 创建当前视角的副本
var newViewpoint = doc.CurrentViewpoint.Value.CreateCopy();
// 判断当前是否已经是线框模式
bool isWireframe = (newViewpoint.RenderStyle == ViewpointRenderStyle.Wireframe);
if (!isWireframe)
{
// 切换到线框模式
newViewpoint.RenderStyle = ViewpointRenderStyle.Wireframe;
LogManager.Info("[线框模式] 视图模式已切换为Wireframe");
UpdateMainStatus("已切换到线框模式");
}
else
{
// 切换回着色模式
newViewpoint.RenderStyle = ViewpointRenderStyle.Shaded;
LogManager.Info("[线框模式] 视图模式已切换回Shaded");
UpdateMainStatus("已切换回着色模式");
}
// 应用修改后的视角
doc.CurrentViewpoint.CopyFrom(newViewpoint);
}
catch (Exception ex)
{
LogManager.Error($"切换线框模式失败: {ex.Message}", ex);
UpdateMainStatus("切换线框模式失败");
}
}
private void ExecuteHighlightClashDetectiveResults()
{
if (string.IsNullOrEmpty(_clashIntegration?.CurrentTestName))

View File

@ -389,6 +389,9 @@ NavisworksTransport 检测动画页签视图 - 采用与类别设置和分层管
Command="{Binding ClearPrecomputedCollisionHighlightsCommand}"
IsEnabled="{Binding HasClashDetectiveResults}"
Style="{StaticResource SecondaryButtonStyle}"/>
<Button Content="线框模式"
Command="{Binding ToggleWireframeModeCommand}"
Style="{StaticResource SecondaryButtonStyle}"/>
</StackPanel>
</StackPanel>
</Border>