fix: 按尾号标准计算最小刀径,排除粉尘刀与去毛刺刀

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-09 17:44:07 +08:00
parent c20a2c62b8
commit b51a5cecf8
4 changed files with 94 additions and 111 deletions

View File

@@ -302,46 +302,14 @@ namespace DrillTools
/// <summary>
/// 从 MainWindowViewModel.Tools 独立遍历计算叠板用最小刀径。
/// 分类逻辑与 UpdateMinDiameterInfo 一致(按 ToolType 区分圆孔/槽孔),不排除 0.749mm
/// 分类逻辑与 UpdateMinDiameterInfo 一致(按尾号使用标准),不排除 0.749mm
/// 特殊固定孔径3.203 等)不参与叠板计算。
/// </summary>
private static void CalculateStackMinDiameters(
ObservableCollection<ToolItem> tools,
StartupSelectionViewModel selectionViewModel)
{
double minDrill = 0;
double minSlot = 0;
double minEA = 0;
foreach (var tool in tools)
{
if (tool.ToolType == ToolType.MachineCode)
continue;
if (ToolItem.IsSpecialFixedDiameter(tool.Diameter))
continue;
if (tool.ToolType == ToolType.Regular)
{
if (minDrill == 0 || tool.Diameter < minDrill)
minDrill = tool.Diameter;
}
else if (tool.ToolType == ToolType.Slot)
{
if (tool.ToolSuffixType != ToolSuffixType.EASlot && tool.ToolSuffixType != ToolSuffixType.EASlot2)
{
if (minSlot == 0 || tool.Diameter < minSlot)
minSlot = tool.Diameter;
}
if ((tool.ToolSuffixType == ToolSuffixType.EASlot || tool.ToolSuffixType == ToolSuffixType.EASlot2)
&& (minEA == 0 || tool.Diameter < minEA))
{
minEA = tool.Diameter;
}
}
}
var (minDrill, minSlot, minEA) = ToolItem.CalculateMinDiameters(tools, exclude749ForDisplay: false);
selectionViewModel.StackCalcMinDrill = minDrill;
selectionViewModel.StackCalcMinSlot = minSlot;
selectionViewModel.StackCalcMinEA = minEA;