fix: 排除3.203等特殊孔径参与叠板计算,槽刀统计对齐真实槽孔
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
36
App.xaml.cs
36
App.xaml.cs
@@ -301,9 +301,9 @@ namespace DrillTools
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从 MainWindowViewModel.Tools 独立遍历计算叠板用最小刀径
|
||||
/// 分类逻辑与 UpdateMinDiameterInfo 一致,但不排除 0.749mm
|
||||
/// 槽刀分类映射:Slot/DustSlot/DeburrSlot → 槽刀,EASlot/EASlot2 → EA刀,Drill → 钻针
|
||||
/// 从 MainWindowViewModel.Tools 独立遍历计算叠板用最小刀径。
|
||||
/// 分类逻辑与 UpdateMinDiameterInfo 一致(按 ToolType 区分圆孔/槽孔),不排除 0.749mm;
|
||||
/// 特殊固定孔径(3.203 等)不参与叠板计算。
|
||||
/// </summary>
|
||||
private static void CalculateStackMinDiameters(
|
||||
ObservableCollection<ToolItem> tools,
|
||||
@@ -315,26 +315,30 @@ namespace DrillTools
|
||||
|
||||
foreach (var tool in tools)
|
||||
{
|
||||
// 机台码刀具(ToolType.MachineCode)是固定孔位,不参与叠板计算
|
||||
if (tool.ToolType == ToolType.MachineCode)
|
||||
continue;
|
||||
|
||||
var category = ToolItem.GetToolCategory(tool.ToolSuffixType);
|
||||
if (ToolItem.IsSpecialFixedDiameter(tool.Diameter))
|
||||
continue;
|
||||
|
||||
switch (category)
|
||||
if (tool.ToolType == ToolType.Regular)
|
||||
{
|
||||
case ToolCategory.Drill:
|
||||
if (minDrill == 0 || tool.Diameter < minDrill)
|
||||
minDrill = tool.Diameter;
|
||||
break;
|
||||
case ToolCategory.Slot:
|
||||
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;
|
||||
break;
|
||||
case ToolCategory.EA:
|
||||
if (minEA == 0 || tool.Diameter < minEA)
|
||||
minEA = tool.Diameter;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((tool.ToolSuffixType == ToolSuffixType.EASlot || tool.ToolSuffixType == ToolSuffixType.EASlot2)
|
||||
&& (minEA == 0 || tool.Diameter < minEA))
|
||||
{
|
||||
minEA = tool.Diameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user