修复测试记录重复的BUG
This commit is contained in:
parent
d09ac6434b
commit
8438d809ae
@ -183,19 +183,39 @@ namespace NavisworksTransport
|
||||
{
|
||||
try
|
||||
{
|
||||
// 首先检查是否已经存在同名测试,如果存在则删除
|
||||
var existingTest = _documentClash.TestsData.Tests.FirstOrDefault(t => t.DisplayName == "动态运输路径碰撞检测");
|
||||
if (existingTest != null)
|
||||
// 清理所有动画相关的测试(包括之前创建的"动画路径碰撞_X"测试)
|
||||
var existingAnimationTests = _documentClash.TestsData.Tests
|
||||
.Where(t => t.DisplayName.StartsWith("动态运输路径碰撞检测") ||
|
||||
t.DisplayName.StartsWith("动画路径碰撞"))
|
||||
.ToList();
|
||||
|
||||
if (existingAnimationTests.Any())
|
||||
{
|
||||
LogManager.Info("删除已存在的动态测试");
|
||||
if (existingTest is ClashTest existingClashTest)
|
||||
LogManager.Info($"发现 {existingAnimationTests.Count} 个需要清理的动画测试");
|
||||
int removedCount = 0;
|
||||
|
||||
foreach (var test in existingAnimationTests)
|
||||
{
|
||||
_documentClash.TestsData.TestsRemove(existingClashTest);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogManager.Warning("找到的测试不是ClashTest类型,无法删除");
|
||||
if (test is ClashTest testToRemove)
|
||||
{
|
||||
try
|
||||
{
|
||||
_documentClash.TestsData.TestsRemove(testToRemove);
|
||||
removedCount++;
|
||||
LogManager.Debug($"已删除测试: {test.DisplayName}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Warning($"删除测试失败 {test.DisplayName}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogManager.Info($"成功清理了 {removedCount} 个旧的动画碰撞测试");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogManager.Info("未发现需要清理的旧动画测试");
|
||||
}
|
||||
|
||||
// 创建新的碰撞测试
|
||||
|
||||
@ -557,6 +557,10 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
}
|
||||
|
||||
// 开始播放物体移动动画
|
||||
// 清理之前的碰撞缓存
|
||||
_logisticsAnimationManager?.ClearExclusionCache();
|
||||
LogManager.Info("已清理UI层碰撞检测缓存");
|
||||
|
||||
// 首先重置进度(开始全新动画时)
|
||||
await _uiStateManager.ExecuteUIUpdateAsync(() =>
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user