- 新增 ExcellonScaler 引擎:普通孔缩放坐标,G85槽孔保护槽长,刀具定义行原样保留 - 新增 DrillScalingWindow 参数设置窗口:倍率/PPM模式切换,X/Y独立输入 - 集成到启动功能菜单:.dr2/.dpin 文件显示"涨缩"按钮 - 输出覆盖原文件 + .bak 备份,GB2312 编码
58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
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();
|
||
}
|
||
}
|
||
}
|