From c657417d6b7445960c0847a2a475b752e198ac73 Mon Sep 17 00:00:00 2001 From: ETWen Date: Fri, 3 Jul 2026 08:34:20 +0800 Subject: [PATCH] feat: v0.5.0 feature round - measurement, view, tree, section, export upgrades Measurement / interaction: - Circle-center snap in Snap(): click near a circular edge to snap to its center (hole-to-hole pitch measuring); nearest of vertex vs circle wins - Esc cancels pending multi-step measurement, then exits mode, then gizmo; hotkeys P/D/E/F/C/A/M toggle measure modes (ignored while typing) - Volume/centroid via mesh signed volume (open-shell detection rejects unreliable results); tree context menu adds it as a measurement View / UI: - Standard views (Iso/Front/Top/Right, Z-up) + orthographic toggle; gizmo overlay camera now switches type to match main camera - GridSplitters for tree/measurement panels; node tooltip shows AABB LxWxH - Tree name filter (matches + ancestors + subtree, auto-expand); context menu: isolate node / invert visibility / show all - Settings persistence (window bounds, unit, 10-file MRU) in %LOCALAPPDATA%/STPViewer/settings.json; recent-files dropdown Files / section: - Interference accepts >=2 visible files, checks all pairs - Export STEP: visible Solids/Shells at current aligned positions via CADability ExportStep; SmokeTest --export-test round-trip verifies - Custom section plane by picking 3 points (axis combo 3-pt); plane position generalized to AABB-corner projection; numeric position input - Bump version to 0.5.0 Co-Authored-By: Claude Fable 5 --- src/STPViewer/MainWindow.xaml | 212 ++++++++++------- src/STPViewer/MainWindow.xaml.cs | 87 +++++++ src/STPViewer/Models/MeasureMode.cs | 1 + src/STPViewer/Models/UnitSystem.cs | 4 + src/STPViewer/STPViewer.csproj | 2 +- src/STPViewer/Services/MeasurementService.cs | 64 +++++- src/STPViewer/Services/SettingsService.cs | 50 ++++ .../ViewModels/MainViewModel.Export.cs | 43 ++++ .../ViewModels/MainViewModel.Gizmo.cs | 33 ++- .../ViewModels/MainViewModel.Interference.cs | 27 ++- .../ViewModels/MainViewModel.Section.cs | 172 ++++++++++++-- src/STPViewer/ViewModels/MainViewModel.cs | 213 +++++++++++++++++- .../ViewModels/ModelNodeViewModel.cs | 44 +++- tools/SmokeTest/ExportTest.cs | 53 +++++ tools/SmokeTest/Program.cs | 3 + 15 files changed, 890 insertions(+), 118 deletions(-) create mode 100644 src/STPViewer/Services/SettingsService.cs create mode 100644 tools/SmokeTest/ExportTest.cs diff --git a/src/STPViewer/MainWindow.xaml b/src/STPViewer/MainWindow.xaml index 9ffc036..aa8172e 100644 --- a/src/STPViewer/MainWindow.xaml +++ b/src/STPViewer/MainWindow.xaml @@ -7,7 +7,8 @@ Title="STPViewer — STP/STEP 3D 檢視器" Height="820" Width="1320" WindowStartupLocation="CenterScreen" - AllowDrop="True" Drop="Window_Drop" DragOver="Window_DragOver"> + AllowDrop="True" Drop="Window_Drop" DragOver="Window_DragOver" + PreviewKeyDown="Window_PreviewKeyDown"> @@ -25,23 +26,37 @@ + + + + + + + 正交 + - 📍 點 - 📏 距離 - 📐 邊 - ⬛ 面 - ⭕ 圓 - ∠ 角度 - ⇔ 面距 ⊹ 操作器 + ToolTip="干涉檢查:2 個以上可見檔案兩兩檢查是否相交(match 判定);無相交時回報最小間隙">🧩 干涉 + ToolTip="清除全部量測與標記(Esc = 取消進行中量測/退出模式)">🧹 清除 mm ⇄ in @@ -77,22 +92,27 @@ ToolTip="量測結果匯出 CSV">💾 CSV + ✂ 剖面 - X Y Z + 3點 - + + @@ -111,75 +131,105 @@ - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + +