Files
AohDrllTools/DrillScalingWindow.xaml.cs
Mr.Xia cacbbe6c33 feat: 增加钻带涨缩功能,支持倍率/PPM模式缩放坐标
- 新增 ExcellonScaler 引擎:普通孔缩放坐标,G85槽孔保护槽长,刀具定义行原样保留
- 新增 DrillScalingWindow 参数设置窗口:倍率/PPM模式切换,X/Y独立输入
- 集成到启动功能菜单:.dr2/.dpin 文件显示"涨缩"按钮
- 输出覆盖原文件 + .bak 备份,GB2312 编码
2026-06-05 22:17:15 +08:00

58 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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();
}
}
}