feat: 大模型评估引导批处理(非手工指定模式生成动画入口)
背景:交互模式 + 非手工指定 + 大型模型 → 主 NW 全模型检测小时级; 剖面盒导出(F1 副实例)已解决耗时问题——生成动画入口增加评估环节。 改动: - BatchConfig.LargeModelFileSizeMb(默认 50 MB,config.toml [batch] large_model_file_size_mb 可调) - ExecuteGenerateAnimation 入口:非手工指定模式 + 模型文件大小 ≥ 阈值 → 弹窗引导:'是' = 加入批处理队列(提示到批处理页签启动)、 '否' = 继续当前进程检测;小模型静默继续(O(1) 评估零延迟) - TryGetCurrentModelFileSizeMb:文档文件大小(MB) 阈值思路:NWD 文件大小与几何对象数强相关,O(1) 获取; 不做对象数枚举(大模型枚举 10+ 秒违背评估目的) 验证:集成测试 25/25
This commit is contained in:
parent
6ef11b752a
commit
3884d05717
@ -99,6 +99,11 @@ width_limit_meters = 3.0
|
||||
# 每个实例独立端口(18778 起)与日志,用于剖面盒自动检测等任务加速
|
||||
max_parallel_instances = 3
|
||||
|
||||
# 大模型阈值(MB):非手工指定模式点击“生成动画”时,
|
||||
# 模型文件超过该大小则引导使用批处理(剖面盒副实例检测,显著加速)
|
||||
# 小模型静默继续当前检测;可调:小模型误判调大,大模型漏判调小
|
||||
large_model_file_size_mb = 50.0
|
||||
|
||||
# 自定义物流类别
|
||||
# 用于扩展内置类别,只需填写类别名称
|
||||
#
|
||||
|
||||
@ -346,5 +346,11 @@ namespace NavisworksTransport.Core.Config
|
||||
/// 并发副 Navisworks 实例数(默认 3,范围 1-20)
|
||||
/// </summary>
|
||||
public int MaxParallelInstances { get; set; } = 3;
|
||||
|
||||
/// <summary>
|
||||
/// 大模型阈值(MB):非手工指定模式点击“生成动画”时,
|
||||
/// 模型文件超过该大小则引导使用批处理(剖面盒副实例检测)
|
||||
/// </summary>
|
||||
public double LargeModelFileSizeMb { get; set; } = 50.0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4873,6 +4873,39 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
// 🔥 大模型评估(非手工指定模式):全模型检测在大型模型上耗时长(小时级),
|
||||
// 引导使用批处理(剖面盒副实例检测)。文件大小 O(1) 评估,零延迟。
|
||||
if (!IsManualCollisionTargetEnabled && TryGetCurrentModelFileSizeMb(out double modelFileSizeMb))
|
||||
{
|
||||
double largeModelThresholdMb = ConfigManager.Instance.Current?.Batch?.LargeModelFileSizeMb ?? 50.0;
|
||||
if (modelFileSizeMb >= largeModelThresholdMb)
|
||||
{
|
||||
LogManager.Info($"[大模型评估] 模型 {modelFileSizeMb:F0} MB >= 阈值 {largeModelThresholdMb:F0} MB,引导使用批处理");
|
||||
var confirm = System.Windows.MessageBox.Show(
|
||||
$"检测到大型模型({modelFileSizeMb:F0} MB)。非手工指定模式的全模型碰撞检测预计耗时很长。\n\n" +
|
||||
$"• 是:加入批处理队列(推荐——使用剖面盒副实例检测,显著加速,检测结果完整落库)\n" +
|
||||
$"• 否:继续在当前进程检测(耗时可能很长)\n\n" +
|
||||
$"(阈值可在 config.toml [batch] large_model_file_size_mb 调整,当前 {largeModelThresholdMb:F0} MB)",
|
||||
"大型模型检测建议",
|
||||
System.Windows.MessageBoxButton.YesNo,
|
||||
System.Windows.MessageBoxImage.Warning);
|
||||
|
||||
if (confirm == System.Windows.MessageBoxResult.Yes)
|
||||
{
|
||||
Mouse.OverrideCursor = oldCursor;
|
||||
ExecuteAddToBatchQueue();
|
||||
System.Windows.MessageBox.Show(
|
||||
"已将当前配置加入批处理队列,请到批处理页签启动执行。",
|
||||
"已加入批处理",
|
||||
System.Windows.MessageBoxButton.OK,
|
||||
System.Windows.MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
LogManager.Info("[大模型评估] 用户选择继续在当前进程检测");
|
||||
}
|
||||
}
|
||||
|
||||
// 设置等待光标
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
|
||||
@ -6014,6 +6047,35 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前模型文件大小(MB)。O(1) 评估——大模型引导批处理用。
|
||||
/// </summary>
|
||||
private static bool TryGetCurrentModelFileSizeMb(out double fileSizeMb)
|
||||
{
|
||||
fileSizeMb = 0.0;
|
||||
try
|
||||
{
|
||||
var doc = Autodesk.Navisworks.Api.Application.ActiveDocument;
|
||||
if (doc == null || doc.IsClear || string.IsNullOrWhiteSpace(doc.FileName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var fileInfo = new System.IO.FileInfo(doc.FileName);
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fileSizeMb = fileInfo.Length / (1024.0 * 1024.0);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加到批处理队列
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user