Handle G84 circular expansion hole counts
This commit is contained in:
@@ -54,7 +54,7 @@ namespace DrillTools.Integration
|
||||
|
||||
foreach (var hole in toolHoles)
|
||||
{
|
||||
if (hole.Type == HoleType.Slot)
|
||||
if (hole.Type == HoleType.Slot || hole.Type == HoleType.CircularExpansion)
|
||||
{
|
||||
hasSlotHoles = true;
|
||||
break;
|
||||
@@ -135,6 +135,12 @@ namespace DrillTools.Integration
|
||||
string location = $"{startLocation}G85{endLocation}";
|
||||
locations.Add(location);
|
||||
}
|
||||
else if (hole.Type == HoleType.CircularExpansion)
|
||||
{
|
||||
slotHoles += hole.DrillHitCount;
|
||||
slotCount++;
|
||||
locations.Add(hole.OriginalCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,6 +332,24 @@ namespace DrillTools.Integration
|
||||
var trimmedLine = line.Trim();
|
||||
if (string.IsNullOrEmpty(trimmedLine)) continue;
|
||||
|
||||
// 检查是否是圆形扩孔(G84指令)
|
||||
var circularExpansionPattern = @"X([+-]?\d+\.?\d*)Y([+-]?\d+\.?\d*)G84X([+-]?\d+\.?\d*)";
|
||||
var circularExpansionMatch = Regex.Match(trimmedLine, circularExpansionPattern);
|
||||
|
||||
if (circularExpansionMatch.Success)
|
||||
{
|
||||
var expansion = SlotHoleCalculator.ParseCircularExpansionFromG84(circularExpansionMatch.Value, tool.Diameter);
|
||||
holes.Add(new HoleInfo
|
||||
{
|
||||
ToolNumber = tool.Number,
|
||||
Type = HoleType.CircularExpansion,
|
||||
CircularExpansion = expansion,
|
||||
DrillHitCount = SlotHoleCalculator.CalculateCircularExpansionHoleCount(expansion),
|
||||
OriginalCommand = trimmedLine
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
// 检查是否是槽孔(G85指令)
|
||||
var slotPattern = @"X([+-]?\d+\.?\d*)Y([+-]?\d+\.?\d*)G85X([+-]?\d+\.?\d*)Y([+-]?\d+\.?\d*)";
|
||||
var slotMatch = Regex.Match(trimmedLine, slotPattern);
|
||||
@@ -450,6 +474,9 @@ namespace DrillTools.Integration
|
||||
public HoleType Type { get; set; }
|
||||
public Point2D Position { get; set; }
|
||||
public LineSlot Slot { get; set; }
|
||||
public CircularExpansion CircularExpansion { get; set; }
|
||||
public int DrillHitCount { get; set; }
|
||||
public string OriginalCommand { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -458,7 +485,8 @@ namespace DrillTools.Integration
|
||||
public enum HoleType
|
||||
{
|
||||
Regular, // 普通圆孔
|
||||
Slot // 槽孔
|
||||
Slot, // 槽孔
|
||||
CircularExpansion // 圆形扩孔
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user