fix: use ancestor chain check for pick item matching terminal object
- PickItemFromPoint returns leaf geometry, not the parent container - Check if pickItem is terminalObject or its descendant via AncestorsAndSelf
This commit is contained in:
parent
e485629360
commit
01195434b7
@ -2527,10 +2527,23 @@ namespace NavisworksTransport.UI.WPF.ViewModels
|
||||
// 恢复选择工具
|
||||
try { NavisApplication.MainDocument.Tool.Value = Tool.Select; } catch { }
|
||||
|
||||
if (!result.IsValid || result.ModelItem != _assemblyTerminalObject)
|
||||
if (!result.IsValid)
|
||||
{
|
||||
CleanupAssemblyEndFaceSelection(clearVisuals: false);
|
||||
UpdateMainStatus("取面失败: 未命中有效面。");
|
||||
return;
|
||||
}
|
||||
|
||||
// PickItemFromPoint 返回的是底层几何节点,需要沿父链检查是否属于终点箱体
|
||||
var pickItem = result.ModelItem;
|
||||
var matched = pickItem != null && (
|
||||
pickItem == _assemblyTerminalObject ||
|
||||
pickItem.AncestorsAndSelf.Any(a => a == _assemblyTerminalObject));
|
||||
if (!matched)
|
||||
{
|
||||
CleanupAssemblyEndFaceSelection(clearVisuals: false);
|
||||
UpdateMainStatus("取面失败: 请确认点击的是终点箱体的端面。");
|
||||
LogManager.Debug($"[直线装配] 取面命中 {ModelItemAnalysisHelper.GetSafeDisplayName(pickItem)}, 非终点箱体");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user