优化碰撞结果显示名称,预获取运动物体名称并简化父容器查找
This commit is contained in:
parent
cdd6ee9319
commit
bc39552ed2
@ -697,6 +697,9 @@ namespace NavisworksTransport
|
||||
skippedCount += (sortedCandidates.Count - 1 - i); // 记录跳过的数量
|
||||
|
||||
int subResultIndex = 1;
|
||||
// 🔥 优化:预获取运动物体名称,避免在循环中重复获取
|
||||
var animatedObjectName = ModelItemAnalysisHelper.GetSafeDisplayName(animatedObject);
|
||||
|
||||
foreach (var child in refreshedTempTest.Children)
|
||||
{
|
||||
if (child is ClashResult result)
|
||||
@ -704,10 +707,12 @@ namespace NavisworksTransport
|
||||
var copiedResult = result.CreateCopy() as ClashResult;
|
||||
copiedResult.Guid = Guid.NewGuid(); // 生成新的GUID
|
||||
|
||||
// 🔥 优化:简化 DisplayName,避免复杂的父容器查找
|
||||
// 详细的名称将在去重后统一设置
|
||||
// 设置碰撞名称:运动物体名称直接使用预获取的,被撞物体查找父容器
|
||||
var container2 = ModelItemAnalysisHelper.FindNamedParentContainer(result.Item2);
|
||||
var object2Name = ModelItemAnalysisHelper.GetSafeDisplayName(container2);
|
||||
|
||||
var timeStamp = DateTime.Now.ToString("HHmmss");
|
||||
copiedResult.DisplayName = $"碰撞_{confirmedCount:00}_{subResultIndex:00}_{timeStamp}";
|
||||
copiedResult.DisplayName = $"物流碰撞#{confirmedCount:00}-{subResultIndex:00}_{timeStamp}: {animatedObjectName} ↔ {object2Name}";
|
||||
|
||||
collisionGroup.Children.Add(copiedResult);
|
||||
subResultIndex++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user