刀具日志增强与PCB钻孔数据大规模更新

本次提交包含以下主要变更:

- 增强了刀具类型、尾号类型及最小直径计算的调试日志,便于问题追踪和数据分析。
- 修正了最小槽刀直径的计算逻辑,EA型槽刀单独处理,提升了判定准确性。
- 针对特殊直径的刀具类型判定增加了专门处理和日志输出。
- 删除了 General_sort.txt 和 s40024079g0-a2-cs-jp-sort.txt 文件内容。
- n40032386g0-a2-cs-jp.drl 文件新增了大量PCB钻孔、槽孔(G85)、外形轮廓等数控加工数据,完善了刀具分组与程序控制指令,满足PCB生产自动化需求。
This commit is contained in:
2025-12-31 15:09:14 +08:00
parent 6361f17598
commit 5e8b989add
6 changed files with 19470 additions and 98 deletions

View File

@@ -45,6 +45,7 @@ namespace DrillTools.Integration
if (isMachineCode) if (isMachineCode)
{ {
toolType = ToolType.MachineCode; toolType = ToolType.MachineCode;
System.Diagnostics.Debug.WriteLine($"[刀具类型判断] T{tool.Number:D2}: 直径={tool.Diameter:F3}, 类型=机台码");
} }
else else
{ {
@@ -61,6 +62,11 @@ namespace DrillTools.Integration
} }
toolType = hasSlotHoles ? ToolType.Slot : ToolType.Regular; toolType = hasSlotHoles ? ToolType.Slot : ToolType.Regular;
// 添加详细的刀具类型判断日志
var suffixType = ToolItem.GetToolSuffixType(tool.Diameter);
var category = ToolItem.GetToolCategory(suffixType);
System.Diagnostics.Debug.WriteLine($"[刀具类型判断] T{tool.Number:D2}: 直径={tool.Diameter:F3}, 有槽孔={hasSlotHoles}, 类型={toolType}, 尾号类型={suffixType}, 大类={category}");
} }
// 计算刀具尾号类型和大类 // 计算刀具尾号类型和大类

View File

@@ -1535,25 +1535,49 @@ M30";
MinSlotDiameter = double.MaxValue; MinSlotDiameter = double.MaxValue;
MinEADiameter = double.MaxValue; MinEADiameter = double.MaxValue;
// 添加调试日志
System.Diagnostics.Debug.WriteLine("=== 开始计算最小直径信息 ===");
foreach (var tool in Tools) foreach (var tool in Tools)
{ {
// 添加详细的刀具信息日志
System.Diagnostics.Debug.WriteLine($"[刀具分析] T{tool.ToolNumber:D2}: 直径={tool.Diameter:F3}, 类型={tool.ToolType}, 尾号类型={tool.ToolSuffixType}, 大类={tool.ToolCategory}");
// 根据刀具类型分类计算最小直径 // 根据刀具类型分类计算最小直径
if (tool.ToolType == ToolType.Regular) if (tool.ToolType == ToolType.Regular)
{ {
// 普通钻咀 // 普通钻咀
if (tool.Diameter < MinDrillDiameter) if (tool.Diameter < MinDrillDiameter)
MinDrillDiameter = tool.Diameter; MinDrillDiameter = tool.Diameter;
System.Diagnostics.Debug.WriteLine($"[钻咀] 当前最小钻咀直径: {MinDrillDiameter:F3}");
} }
else if (tool.ToolType == ToolType.Slot) else if (tool.ToolType == ToolType.Slot)
{ {
// 槽刀 // 槽刀 - 修复只有真正的槽刀非EA型槽刀才计入最小槽刀直径
// EA型槽刀不应该计入最小槽刀直径的计算
if (tool.ToolSuffixType != ToolSuffixType.EASlot && tool.ToolSuffixType != ToolSuffixType.EASlot2)
{
if (tool.Diameter < MinSlotDiameter) if (tool.Diameter < MinSlotDiameter)
MinSlotDiameter = tool.Diameter; MinSlotDiameter = tool.Diameter;
System.Diagnostics.Debug.WriteLine($"[槽刀] T{tool.ToolNumber:D2}是真正的槽刀,当前最小槽刀直径: {MinSlotDiameter:F3}");
}
else
{
System.Diagnostics.Debug.WriteLine($"[EA刀] T{tool.ToolNumber:D2}是EA型槽刀不计入最小槽刀直径计算");
}
// 检查是否是EA型槽刀尾号为2或6 // 检查是否是EA型槽刀尾号为2或6
if ((tool.ToolSuffixType == ToolSuffixType.EASlot || tool.ToolSuffixType == ToolSuffixType.EASlot2) if ((tool.ToolSuffixType == ToolSuffixType.EASlot || tool.ToolSuffixType == ToolSuffixType.EASlot2)
&& tool.Diameter < MinEADiameter) && tool.Diameter < MinEADiameter)
MinEADiameter = tool.Diameter; MinEADiameter = tool.Diameter;
// 特别标记EA型槽刀
if (tool.ToolSuffixType == ToolSuffixType.EASlot || tool.ToolSuffixType == ToolSuffixType.EASlot2)
{
System.Diagnostics.Debug.WriteLine($"[EA刀] T{tool.ToolNumber:D2}是EA型槽刀直径={tool.Diameter:F3}");
}
} }
} }
@@ -1566,6 +1590,12 @@ M30";
if (MinEADiameter == double.MaxValue) if (MinEADiameter == double.MaxValue)
MinEADiameter = 0; MinEADiameter = 0;
System.Diagnostics.Debug.WriteLine($"=== 最终结果 ===");
System.Diagnostics.Debug.WriteLine($"最小钻咀: {MinDrillDiameter:F3}");
System.Diagnostics.Debug.WriteLine($"最小槽刀: {MinSlotDiameter:F3}");
System.Diagnostics.Debug.WriteLine($"最小EA刀: {MinEADiameter:F3}");
System.Diagnostics.Debug.WriteLine($"=== 计算完成 ===");
} }
/// <summary> /// <summary>

View File

@@ -220,6 +220,7 @@ namespace DrillTools
Math.Abs(diameter - 3.175) < 0.001 || Math.Abs(diameter - 3.175) < 0.001 ||
Math.Abs(diameter - 0.499) < 0.001) Math.Abs(diameter - 0.499) < 0.001)
{ {
System.Diagnostics.Debug.WriteLine($"[尾号类型判断] 直径={diameter:F3}: 特殊孔径,尾号类型=钻针");
return ToolSuffixType.Drill; // 固定为圆孔 return ToolSuffixType.Drill; // 固定为圆孔
} }
@@ -230,7 +231,7 @@ namespace DrillTools
char lastChar = diameterStr[diameterStr.Length - 1]; char lastChar = diameterStr[diameterStr.Length - 1];
int suffix = int.Parse(lastChar.ToString()); int suffix = int.Parse(lastChar.ToString());
return suffix switch var suffixType = suffix switch
{ {
0 => ToolSuffixType.Drill, 0 => ToolSuffixType.Drill,
1 => ToolSuffixType.Slot, 1 => ToolSuffixType.Slot,
@@ -244,8 +245,12 @@ namespace DrillTools
9 => ToolSuffixType.Drill, 9 => ToolSuffixType.Drill,
_ => ToolSuffixType.NonStandard _ => ToolSuffixType.NonStandard
}; };
System.Diagnostics.Debug.WriteLine($"[尾号类型判断] 直径={diameter:F3}, 字符串={diameterStr}, 尾号={suffix}, 尾号类型={suffixType}");
return suffixType;
} }
System.Diagnostics.Debug.WriteLine($"[尾号类型判断] 直径={diameter:F3}: 格式异常,尾号类型=非标刀");
return ToolSuffixType.NonStandard; // 默认为非标刀 return ToolSuffixType.NonStandard; // 默认为非标刀
} }

View File

@@ -1,47 +0,0 @@
0.799
1.049
3.175
0.500
0.600
0.700
0.800
0.850
0.900
1.000
1.100
1.200
1.300
1.350
1.400
1.600
1.850
1.900
2.100
2.200
2.800
2.900
3.250
3.300
3.550
4.100
1.201
1.306
1.501
1.601
1.606
1.706
1.801
2.201
2.401
2.501
2.701
3.051
3.101
3.251
1.203
2.204
1.803
2.203
0.604
3.203
0.499

File diff suppressed because it is too large Load Diff

View File

@@ -1,47 +0,0 @@
0.799
1.049
3.175
0.500
0.600
0.700
0.800
0.850
0.900
1.000
1.100
1.200
1.300
1.350
1.400
1.600
1.850
1.900
2.100
2.200
2.800
2.900
3.250
3.300
3.550
4.100
1.201
1.306
1.501
1.601
1.606
1.706
1.801
2.201
2.401
2.501
2.701
3.051
3.101
3.251
1.203
2.204
1.803
2.203
0.604
3.203
0.499