diff --git a/XplorePlane/Services/Cnc/CncExecutionService.cs b/XplorePlane/Services/Cnc/CncExecutionService.cs index 671037b..66aea22 100644 --- a/XplorePlane/Services/Cnc/CncExecutionService.cs +++ b/XplorePlane/Services/Cnc/CncExecutionService.cs @@ -722,9 +722,9 @@ namespace XplorePlane.Services.Cnc var manualImage = _mainViewportService?.LatestManualImage as BitmapSource; if (manualImage != null) { - _logger.ForModule().Info( - "[图像链路] TryGetSourceImage:从 MainViewportService.LatestManualImage 获取图像,尺寸 {W}x{H}", - manualImage.PixelWidth, manualImage.PixelHeight); + //_logger.ForModule().Info( + // "[图像链路] TryGetSourceImage:从 MainViewportService.LatestManualImage 获取图像,尺寸 {W}x{H}", + // manualImage.PixelWidth, manualImage.PixelHeight); return manualImage; } diff --git a/XplorePlane/Services/Cnc/CncProgramService.cs b/XplorePlane/Services/Cnc/CncProgramService.cs index 01edd34..d922e9b 100644 --- a/XplorePlane/Services/Cnc/CncProgramService.cs +++ b/XplorePlane/Services/Cnc/CncProgramService.cs @@ -374,8 +374,8 @@ namespace XplorePlane.Services.Cnc result.Add(indexedNode switch { ReferencePointNode referencePointNode => referencePointNode with { Name = $"\u53C2\u8003\u70B9_{referencePointNumber++}" }, - SavePositionNode savePositionNode => savePositionNode with { Name = $"\u4FDD\u5B58\u4F4D\u7F6E_{savePositionNumber++}" }, - InspectionModuleNode inspectionModuleNode => inspectionModuleNode with { Name = $"\u68C0\u6D4B\u6A21\u5757_{inspectionModuleNumber++}" }, + SavePositionNode savePositionNode => savePositionNode with { Name = $"\u4F4D\u7F6E{++savePositionNumber}" }, + InspectionModuleNode inspectionModuleNode => inspectionModuleNode with { Name = $"\u6A21\u5757{++inspectionModuleNumber}" }, _ => indexedNode }); } diff --git a/XplorePlane/Services/MainViewport/DetectorFramePipelineService.cs b/XplorePlane/Services/MainViewport/DetectorFramePipelineService.cs index 03c70f5..fbd1588 100644 --- a/XplorePlane/Services/MainViewport/DetectorFramePipelineService.cs +++ b/XplorePlane/Services/MainViewport/DetectorFramePipelineService.cs @@ -77,11 +77,11 @@ namespace XplorePlane.Services.MainViewport try { - _logger.Info( - "[图像链路] DetectorFramePipeline 收到帧 #{N},分辨率 {W}x{H},采集时间 {T},当前队列深度 AcquireQ={AQ} ProcessQ={PQ}", - args.FrameNumber, args.Width, args.Height, - args.CaptureTime.ToString("HH:mm:ss.fff"), - AcquireQueueCount, ProcessQueueCount); + //_logger.Info( + // "[图像链路] DetectorFramePipeline 收到帧 #{N},分辨率 {W}x{H},采集时间 {T},当前队列深度 AcquireQ={AQ} ProcessQ={PQ}", + // args.FrameNumber, args.Width, args.Height, + // args.CaptureTime.ToString("HH:mm:ss.fff"), + // AcquireQueueCount, ProcessQueueCount); var rawPixels = new ushort[args.ImageData.Length]; Array.Copy(args.ImageData, rawPixels, rawPixels.Length); diff --git a/XplorePlane/ViewModels/Cnc/CncEditorViewModel.cs b/XplorePlane/ViewModels/Cnc/CncEditorViewModel.cs index 13a55ea..fd9a1a4 100644 --- a/XplorePlane/ViewModels/Cnc/CncEditorViewModel.cs +++ b/XplorePlane/ViewModels/Cnc/CncEditorViewModel.cs @@ -1005,15 +1005,50 @@ namespace XplorePlane.ViewModels.Cnc result.Add(indexedNode switch { ReferencePointNode referencePointNode => referencePointNode with { Name = $"\u53C2\u8003\u70B9_{referencePointNumber++}" }, - SavePositionNode savePositionNode => savePositionNode with { Name = $"\u4FDD\u5B58\u4F4D\u7F6E_{savePositionNumber++}" }, - InspectionModuleNode inspectionModuleNode => inspectionModuleNode with { Name = $"\u68C0\u6D4B\u6A21\u5757_{inspectionModuleNumber++}" }, + // 保存位置:用户自定义名称时保留,否则用"位置N"(1-based) + SavePositionNode savePositionNode => IsDefaultSavePositionName(savePositionNode.Name) + ? savePositionNode with { Name = $"\u4F4D\u7F6E{++savePositionNumber}" } + : (CncNode)(savePositionNode with { Index = i }), + // 检测模块:用户自定义名称时保留,否则用"模块N"(1-based) + InspectionModuleNode inspectionModuleNode => IsDefaultInspectionModuleName(inspectionModuleNode.Name) + ? inspectionModuleNode with { Name = $"\u6A21\u5757{++inspectionModuleNumber}" } + : (CncNode)(inspectionModuleNode with { Index = i }), _ => indexedNode }); + // 无论是否重命名,计数器都要递增以保持后续编号连续 + if (indexedNode is SavePositionNode sp && !IsDefaultSavePositionName(sp.Name)) + savePositionNumber++; + if (indexedNode is InspectionModuleNode im && !IsDefaultInspectionModuleName(im.Name)) + inspectionModuleNumber++; } return result.AsReadOnly(); } + /// 判断是否为系统默认的保存位置名称("位置N" 格式) + private static bool IsDefaultSavePositionName(string name) + { + if (string.IsNullOrWhiteSpace(name)) return true; + if (name.StartsWith("\u4F4D\u7F6E", StringComparison.Ordinal)) + return int.TryParse(name[2..], out _); + // 兼容旧格式 "保存位置_N" + if (name.StartsWith("\u4FDD\u5B58\u4F4D\u7F6E_", StringComparison.Ordinal)) + return true; + return false; + } + + /// 判断是否为系统默认的检测模块名称("模块N" 或旧格式 "检测模块_N") + private static bool IsDefaultInspectionModuleName(string name) + { + if (string.IsNullOrWhiteSpace(name)) return true; + if (name.StartsWith("\u6A21\u5757", StringComparison.Ordinal)) + return int.TryParse(name[2..], out _); + // 兼容旧格式 "检测模块_N" + if (name.StartsWith("\u68C0\u6D4B\u6A21\u5757_", StringComparison.Ordinal)) + return true; + return false; + } + private static bool IsSavePositionChild(CncNodeType type) { return type is CncNodeType.InspectionMarker diff --git a/XplorePlane/Views/Cnc/CncPageView.xaml b/XplorePlane/Views/Cnc/CncPageView.xaml index 91487ce..a3d8dfa 100644 --- a/XplorePlane/Views/Cnc/CncPageView.xaml +++ b/XplorePlane/Views/Cnc/CncPageView.xaml @@ -20,18 +20,105 @@ - + - - + + Microsoft YaHei UI + + + + + + - + - - - - - + CornerRadius="6" + SnapsToDevicePixels="True"> + - - + - - - - - - - - - - - - - - -