feat: 增加钻带涨缩功能,支持倍率/PPM模式缩放坐标

- 新增 ExcellonScaler 引擎:普通孔缩放坐标,G85槽孔保护槽长,刀具定义行原样保留
- 新增 DrillScalingWindow 参数设置窗口:倍率/PPM模式切换,X/Y独立输入
- 集成到启动功能菜单:.dr2/.dpin 文件显示"涨缩"按钮
- 输出覆盖原文件 + .bak 备份,GB2312 编码
This commit is contained in:
2026-06-05 22:17:15 +08:00
parent f050a606ef
commit cacbbe6c33
7 changed files with 505 additions and 2 deletions

View File

@@ -0,0 +1,57 @@
using System.Windows;
namespace DrillTools
{
/// <summary>
/// 钻带涨缩参数设置窗口
/// </summary>
public partial class DrillScalingWindow : Window
{
private readonly DrillScalingViewModel _viewModel;
/// <summary>
/// 用户确认后的缩放结果kx, ky
/// </summary>
public (double Kx, double Ky)? ScalingResult { get; private set; }
public DrillScalingWindow()
{
InitializeComponent();
_viewModel = new DrillScalingViewModel();
DataContext = _viewModel;
}
private void ModeRadioButton_Changed(object sender, RoutedEventArgs e)
{
if (_viewModel == null)
return;
if (RatioRadioButton.IsChecked == true)
_viewModel.Mode = ScalingMode.Ratio;
else if (PpmRadioButton.IsChecked == true)
_viewModel.Mode = ScalingMode.Ppm;
}
private void ExecuteButton_Click(object sender, RoutedEventArgs e)
{
var error = _viewModel.Validate();
if (error != null)
{
ErrorText.Text = error;
ErrorText.Visibility = Visibility.Visible;
return;
}
ScalingResult = (_viewModel.Kx, _viewModel.Ky);
DialogResult = true;
Close();
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
ScalingResult = null;
DialogResult = false;
Close();
}
}
}