From 58f3a19232216e180d44b50848864b4512eed1d9 Mon Sep 17 00:00:00 2001 From: iamboss Date: Sat, 11 Apr 2026 11:19:38 +0800 Subject: [PATCH] refactor(Sample.Wpf): use WorkpieceService and CatchExceptions in DemoMillingByCutterLocation Made-with: Cursor --- Machining/DemoMillingByCutterLocation.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Machining/DemoMillingByCutterLocation.cs b/Machining/DemoMillingByCutterLocation.cs index c65ba9b..ccf5766 100644 --- a/Machining/DemoMillingByCutterLocation.cs +++ b/Machining/DemoMillingByCutterLocation.cs @@ -53,8 +53,8 @@ namespace Sample.Machining localProjectService.ClStrip.IsShowDot = true; double resolution_mm = 0.5; var projectDir = Path.GetDirectoryName(projectPath); - localProjectService.Workpiece.InitGeom = new StlFile(stlFile_CylinderR20, projectDir); - localProjectService.Workpiece.IdealGeom = new StlFile(stlFile_CylinderR19, projectDir); + localProjectService.WorkpieceService.InitGeom = new StlFile(stlFile_CylinderR20, projectDir); + localProjectService.WorkpieceService.IdealGeom = new StlFile(stlFile_CylinderR19, projectDir); localProjectService.Workpiece.InitResolution = resolution_mm; RuntimeApi runtimeApi = localProjectService.RuntimeApi; @@ -87,7 +87,7 @@ namespace Sample.Machining { RunSession(projectService, resolution_mm); Console.WriteLine($"task done."); - }).ShowIfCatched(null); + }).CatchExceptions(ex => Console.WriteLine(ex)); #region Create and Run WPF Application Application app = new Application @@ -135,7 +135,7 @@ namespace Sample.Machining } static bool IsDifferenceAceptable(LocalProjectService localProjectService, double diffLimit) { - foreach (var attachment in localProjectService.Workpiece.DiffAttachmentBag) + foreach (var attachment in localProjectService.WorkpieceService.DiffAttachmentBag) { if (double.IsNaN(attachment.Diff) || Math.Abs(attachment.Diff) > diffLimit) {