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>
|
/// <summary>
|
||||||
/// 从 MainWindowViewModel.Tools 独立遍历计算叠板用最小刀径
|
/// 从 MainWindowViewModel.Tools 独立遍历计算叠板用最小刀径。
|
||||||
/// 分类逻辑与 UpdateMinDiameterInfo 一致,但不排除 0.749mm
|
/// 分类逻辑与 UpdateMinDiameterInfo 一致(按 ToolType 区分圆孔/槽孔),不排除 0.749mm;
|
||||||
/// 槽刀分类映射:Slot/DustSlot/DeburrSlot → 槽刀,EASlot/EASlot2 → EA刀,Drill → 钻针
|
/// 特殊固定孔径(3.203 等)不参与叠板计算。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void CalculateStackMinDiameters(
|
private static void CalculateStackMinDiameters(
|
||||||
ObservableCollection<ToolItem> tools,
|
ObservableCollection<ToolItem> tools,
|
||||||
@@ -315,26 +315,30 @@ namespace DrillTools
|
|||||||
|
|
||||||
foreach (var tool in tools)
|
foreach (var tool in tools)
|
||||||
{
|
{
|
||||||
// 机台码刀具(ToolType.MachineCode)是固定孔位,不参与叠板计算
|
|
||||||
if (tool.ToolType == ToolType.MachineCode)
|
if (tool.ToolType == ToolType.MachineCode)
|
||||||
continue;
|
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)
|
||||||
if (minDrill == 0 || tool.Diameter < minDrill)
|
minDrill = tool.Diameter;
|
||||||
minDrill = tool.Diameter;
|
}
|
||||||
break;
|
else if (tool.ToolType == ToolType.Slot)
|
||||||
case ToolCategory.Slot:
|
{
|
||||||
|
if (tool.ToolSuffixType != ToolSuffixType.EASlot && tool.ToolSuffixType != ToolSuffixType.EASlot2)
|
||||||
|
{
|
||||||
if (minSlot == 0 || tool.Diameter < minSlot)
|
if (minSlot == 0 || tool.Diameter < minSlot)
|
||||||
minSlot = tool.Diameter;
|
minSlot = tool.Diameter;
|
||||||
break;
|
}
|
||||||
case ToolCategory.EA:
|
|
||||||
if (minEA == 0 || tool.Diameter < minEA)
|
if ((tool.ToolSuffixType == ToolSuffixType.EASlot || tool.ToolSuffixType == ToolSuffixType.EASlot2)
|
||||||
minEA = tool.Diameter;
|
&& (minEA == 0 || tool.Diameter < minEA))
|
||||||
break;
|
{
|
||||||
|
minEA = tool.Diameter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ namespace DrillTools
|
|||||||
public double StackCalcMinDrill { get; set; }
|
public double StackCalcMinDrill { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 叠板计算用的最小槽刀直径(包含 0.749mm 的槽刀,由调用方独立计算)
|
/// 叠板计算用的最小槽刀直径(仅真实槽孔刀,由调用方独立计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double StackCalcMinSlot { get; set; }
|
public double StackCalcMinSlot { get; set; }
|
||||||
|
|
||||||
|
|||||||
16
ToolItem.cs
16
ToolItem.cs
@@ -218,6 +218,18 @@ namespace DrillTools
|
|||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PP定位孔(3.203)、外围参考孔(3.175)、Mark孔(1.049)、机台码(0.499)等特殊孔径。
|
||||||
|
/// 不按尾号归类,且不参与叠板块数计算。
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsSpecialFixedDiameter(double diameter)
|
||||||
|
{
|
||||||
|
return Math.Abs(diameter - 1.049) < 0.001
|
||||||
|
|| Math.Abs(diameter - 3.175) < 0.001
|
||||||
|
|| Math.Abs(diameter - 3.203) < 0.001
|
||||||
|
|| Math.Abs(diameter - 0.499) < 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据孔径尾号判断刀具尾号类型
|
/// 根据孔径尾号判断刀具尾号类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -226,9 +238,7 @@ namespace DrillTools
|
|||||||
public static ToolSuffixType GetToolSuffixType(double diameter)
|
public static ToolSuffixType GetToolSuffixType(double diameter)
|
||||||
{
|
{
|
||||||
// 特殊孔径优先判断
|
// 特殊孔径优先判断
|
||||||
if (Math.Abs(diameter - 1.049) < 0.001 ||
|
if (IsSpecialFixedDiameter(diameter))
|
||||||
Math.Abs(diameter - 3.175) < 0.001 ||
|
|
||||||
Math.Abs(diameter - 0.499) < 0.001)
|
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine($"[尾号类型判断] 直径={diameter:F3}: 特殊孔径,尾号类型=钻针");
|
System.Diagnostics.Debug.WriteLine($"[尾号类型判断] 直径={diameter:F3}: 特殊孔径,尾号类型=钻针");
|
||||||
return ToolSuffixType.Drill; // 固定为圆孔
|
return ToolSuffixType.Drill; // 固定为圆孔
|
||||||
|
|||||||
Reference in New Issue
Block a user