/// 当动画状态发生改变时触发
@@ -1611,45 +1621,53 @@ namespace NavisworksTransport.Core.Animation
_timeLinerManager.UpdateTaskProgress(_currentTaskId, 1.0, AnimationState.Finished);
}
- // 🔥 执行碰撞检测(重复检查已在保存检测记录时完成,这里直接执行)
- LogManager.Info($"开始创建碰撞测试汇总(基于 {_allCollisionResults.Count} 个预计算碰撞记录)...");
-
- // 设置等待光标,避免进度条关闭后的无响应
- var oldCursor = System.Windows.Input.Mouse.OverrideCursor;
- System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
-
- bool testCompleted = false;
- try
+ // 🔥 检查是否使用历史记录,如果是则跳过ClashDetective测试
+ if (_isUsingHistoryRecord)
{
- // 使用用户设置的检测容差(米)
- testCompleted = ClashDetectiveIntegration.Instance.CreateAllAnimationCollisionTests(
- _allCollisionResults,
- _detectionTolerance,
- _currentRouteId,
- _animatedObject,
- _isVirtualObject,
- _animationFrameRate,
- _animationDuration,
- _virtualObjectLength,
- _virtualObjectWidth,
- _virtualObjectHeight,
- _pathPoints,
- _currentDetectionRecordId
- );
- }
- finally
- {
- // 恢复光标
- System.Windows.Input.Mouse.OverrideCursor = oldCursor;
- }
-
- if (testCompleted)
- {
- LogManager.Info($"碰撞测试汇总已创建完成");
+ LogManager.Info("[动画完成] 使用历史检测记录,跳过ClashDetective测试");
}
else
{
- LogManager.Info("碰撞检测被取消");
+ // 🔥 执行碰撞检测(重复检查已在保存检测记录时完成,这里直接执行)
+ LogManager.Info($"开始创建碰撞测试汇总(基于 {_allCollisionResults.Count} 个预计算碰撞记录)...");
+
+ // 设置等待光标,避免进度条关闭后的无响应
+ var oldCursor = System.Windows.Input.Mouse.OverrideCursor;
+ System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
+
+ bool testCompleted = false;
+ try
+ {
+ // 使用用户设置的检测容差(米)
+ testCompleted = ClashDetectiveIntegration.Instance.CreateAllAnimationCollisionTests(
+ _allCollisionResults,
+ _detectionTolerance,
+ _currentRouteId,
+ _animatedObject,
+ _isVirtualObject,
+ _animationFrameRate,
+ _animationDuration,
+ _virtualObjectLength,
+ _virtualObjectWidth,
+ _virtualObjectHeight,
+ _pathPoints,
+ _currentDetectionRecordId
+ );
+ }
+ finally
+ {
+ // 恢复光标
+ System.Windows.Input.Mouse.OverrideCursor = oldCursor;
+ }
+
+ if (testCompleted)
+ {
+ LogManager.Info($"碰撞测试汇总已创建完成");
+ }
+ else
+ {
+ LogManager.Info("碰撞检测被取消");
+ }
}
}
catch (Exception ex)
@@ -2762,6 +2780,13 @@ namespace NavisworksTransport.Core.Animation
_currentDetectionRecordId = null;
}
+ // 🔥 清除历史记录标志,确保动画生成时状态正确
+ if (_isUsingHistoryRecord)
+ {
+ LogManager.Info("[CreateAnimation] 清除历史记录标志,将创建新检测");
+ _isUsingHistoryRecord = false;
+ }
+
_pathName = pathName;
_currentRouteId = routeId;
_isVirtualObject = isVirtualObject; // 设置是否使用虚拟物体
diff --git a/src/UI/WPF/Resources/NavisworksStyles.xaml b/src/UI/WPF/Resources/NavisworksStyles.xaml
index e4711c0..e9401f4 100644
--- a/src/UI/WPF/Resources/NavisworksStyles.xaml
+++ b/src/UI/WPF/Resources/NavisworksStyles.xaml
@@ -202,6 +202,22 @@ NavisworksTransport 共享样式资源字典 - Navisworks 2026风格
M12,2C6.48,2 2,6.48 2,12C2,17.52 6.48,22 12,22C17.52,22 22,17.52 22,12C22,6.48 17.52,2 12,2ZM12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20ZM12,6C8.69,6 6,8.69 6,12C6,15.31 8.69,18 12,18C15.31,18 18,15.31 18,12C18,8.69 15.31,6 12,6ZM12,16C9.79,16 8,14.21 8,12C8,9.79 9.79,8 12,8C14.21,8 16,9.79 16,12C16,14.21 14.21,16 12,16Z
+
+
+
+
+
+
");
html.AppendLine("");
+ // 从数据库获取检测记录信息
+ var (testName, testTime) = GetDetectionRecordInfo(report.ResultId);
+
// 报告标题
html.AppendLine($"NavisworksTransport 碰撞检测报告
");
html.AppendLine($"生成时间: {now:yyyy年MM月dd日 HH:mm:ss}
");
html.AppendLine($"报告类型: 综合报告
");
- html.AppendLine($"路径名称: {report.PathName ?? "未知路径"}
");
+
+ // 检测记录信息
+ html.AppendLine("");
+ html.AppendLine("
检测记录
");
+ html.AppendLine("
");
+ html.AppendLine("
");
+ html.AppendLine("
测试名称
");
+ html.AppendLine($"
{testName ?? "未命名"}
");
+ html.AppendLine("
");
+ html.AppendLine("
");
+ html.AppendLine("
检测时间
");
+ html.AppendLine($"
{testTime}
");
+ html.AppendLine("
");
+ html.AppendLine("
");
+ html.AppendLine("
");
// 总体统计
html.AppendLine("");
@@ -426,5 +443,38 @@ namespace NavisworksTransport.Utils
return null;
}
}
+
+ ///
+ /// 从数据库获取检测记录信息
+ ///
+ private static (string testName, string testTime) GetDetectionRecordInfo(int resultId)
+ {
+ try
+ {
+ if (resultId <= 0)
+ {
+ return (null, "未知时间");
+ }
+
+ var pathDatabase = PathPlanningManager.Instance?.GetPathDatabase();
+ if (pathDatabase == null)
+ {
+ return (null, "未知时间");
+ }
+
+ var record = pathDatabase.GetDetectionResultById(resultId);
+ if (record != null)
+ {
+ string timeStr = record.TestTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? "未知时间";
+ return (record.TestName, timeStr);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Error($"[CollisionReportHtmlGenerator] 获取检测记录信息失败: {ex.Message}");
+ }
+
+ return (null, "未知时间");
+ }
}
}