docs: Refresh ARCHITECTURE/README (EN+zh-TW) for v0.5.0 feature set
- READMEs: version badge 0.5.0, hotkey column in measure table, circle-center snap / standard views / ortho / tree search & isolate / volume / 3-pt section / multi-file interference / STEP export / settings & MRU; version history adds v0.4.0 and v0.5.0 - ARCHITECTURE: overview bullets, data models (ModelNodeViewModel, MeasureMode.Volume) brought up to date Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+22
-18
@@ -12,12 +12,15 @@ STEP(`.stp` / `.step`)檔案做確認與量測,不需要安裝 SolidWorks
|
|||||||
核心價值:
|
核心價值:
|
||||||
|
|
||||||
- **多檔匯入**:一次載入多個 CAD 檔(STEP / STL / DXF),每個檔案自成一棵樹
|
- **多檔匯入**:一次載入多個 CAD 檔(STEP / STL / DXF),每個檔案自成一棵樹
|
||||||
- **裝配樹**:STEP product structure 還原成樹狀節點(組件→零件),逐節點 顯示/隱藏、換色、Zoom-to
|
- **裝配樹**:STEP product structure 還原成樹狀節點(組件→零件),逐節點 顯示/隱藏、換色、Zoom-to;
|
||||||
|
名稱搜尋過濾、隔離顯示(只顯示此節點/反轉/全顯)、tooltip 外形尺寸
|
||||||
- **量測**:點座標、兩點距離、邊長、面(面積/類型/法向量)、圓(心/半徑/直徑/周長)、
|
- **量測**:點座標、兩點距離、邊長、面(面積/類型/法向量)、圓(心/半徑/直徑/周長)、
|
||||||
兩面/兩邊夾角、面到面最短距離;單位 mm ⇄ inch 即時切換
|
兩面/兩邊夾角、面到面最短距離、體積/質心;吸附含**圓心**(量孔對孔 pitch);
|
||||||
- **剖面**:X/Y/Z 軸向剖切,位置滑桿 + 反向,CPU 網格裁切(量測不受影響)
|
快速鍵 P/D/E/F/C/A/M + Esc;單位 mm ⇄ inch 即時切換
|
||||||
- **匯出**:量測結果 CSV、3D 視圖 PNG 截圖(2x)
|
- **剖面**:X/Y/Z 軸向 + **3點任意平面**,位置滑桿/數值輸入 + 反向,CPU 網格裁切(量測不受影響)
|
||||||
- 單機離線執行,無網路相依
|
- **視圖**:標準視圖(等角/前/上/右)+ 正交⇄透視投影
|
||||||
|
- **匯出**:量測結果 CSV、3D 視圖 PNG 截圖(2x)、**目前對齊位置寫成新 STEP 檔**
|
||||||
|
- 單機離線執行,無網路相依;視窗/單位/最近檔案自動保存(settings.json)
|
||||||
|
|
||||||
使用者:單一桌面使用者(無登入 / 角色系統)。
|
使用者:單一桌面使用者(無登入 / 角色系統)。
|
||||||
|
|
||||||
@@ -99,7 +102,7 @@ STPViewer/
|
|||||||
│
|
│
|
||||||
├── Models/
|
├── Models/
|
||||||
│ ├── FaceInfo.cs # GeometryModel3D ↔ B-rep Face 對照(STL 為 null)
|
│ ├── FaceInfo.cs # GeometryModel3D ↔ B-rep Face 對照(STL 為 null)
|
||||||
│ ├── MeasureMode.cs # enum: None/Point/Distance/Edge/Face/Circle/Angle/FaceDistance/Align/Align3/Drag/Interference
|
│ ├── MeasureMode.cs # enum: None/Point/Distance/Edge/Face/Circle/Angle/FaceDistance/Align/Align3/Drag/Interference/Volume
|
||||||
│ ├── MeasurementResult.cs # 量測結果(雙單位 lambda、3D 標籤同步)
|
│ ├── MeasurementResult.cs # 量測結果(雙單位 lambda、3D 標籤同步)
|
||||||
│ └── UnitSystem.cs # mm/inch + Units 格式化
|
│ └── UnitSystem.cs # mm/inch + Units 格式化
|
||||||
│
|
│
|
||||||
@@ -128,29 +131,30 @@ STPViewer/
|
|||||||
桌面程式無資料庫;核心為記憶體內模型:
|
桌面程式無資料庫;核心為記憶體內模型:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// 一個匯入檔 = 一個圖層
|
// 裝配樹節點:root = 匯入檔、group = STEP 裝配、leaf = 零件幾何(可見性/顏色向下 cascade)
|
||||||
class LayerItemViewModel
|
class ModelNodeViewModel
|
||||||
{
|
{
|
||||||
string Name; // 檔名(不含路徑)
|
string Name; // root = 檔名;group/leaf = STEP product 名
|
||||||
string FilePath;
|
string? FilePath; // root 才有值
|
||||||
bool IsVisible; // 切換 viewport 中的 ModelVisual3D
|
bool IsVisible; // 切換 viewport 中的 ModelVisual3D(cascade)
|
||||||
Color Color; // 圖層色(換色重建材質)
|
bool IsFilterVisible; // 樹搜尋過濾結果(只影響樹面板顯示)
|
||||||
|
Color Color; // 節點色(換色只改共用 Brush)
|
||||||
int SolidCount, FaceCount, TriangleCount;
|
int SolidCount, FaceCount, TriangleCount;
|
||||||
ModelVisual3D BodyVisual; // 面網格
|
ModelVisual3D BodyVisual; // leaf:面網格容器(合併/逐面兩種內容切換)
|
||||||
ModelVisual3D EdgeVisual; // 輪廓線
|
LinesVisual3D EdgeVisual; // root:整檔合併輪廓線
|
||||||
Rect3D Bounds; // Zoom-to 用
|
Rect3D Bounds; // Zoom-to / 外形尺寸 / 旋轉中心
|
||||||
}
|
}
|
||||||
|
|
||||||
// HitTest 反查:渲染物件 → B-rep
|
// HitTest 反查:渲染物件 → B-rep
|
||||||
class FaceInfo
|
class FaceInfo
|
||||||
{
|
{
|
||||||
object Face; // CADability Face(量測用 B-rep)
|
Face? BrepFace; // CADability Face(量測用 B-rep;STL 為 null)
|
||||||
LayerItemViewModel Owner;
|
ModelNodeViewModel Owner;
|
||||||
MeshGeometry3D Mesh; // 面積近似 / 頂點吸附
|
MeshGeometry3D Mesh; // 面積近似 / 頂點吸附
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MeasureMode { None, Point, Distance, Edge, Face, Circle,
|
enum MeasureMode { None, Point, Distance, Edge, Face, Circle,
|
||||||
Angle, FaceDistance, Align, Align3, Drag, Interference }
|
Angle, FaceDistance, Align, Align3, Drag, Interference, Volume }
|
||||||
|
|
||||||
class MeasurementResult
|
class MeasurementResult
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
> A Windows desktop 3D viewer for STP/STEP CAD files — multi-file import, assembly tree, and point / distance / edge / face / circle measurement. Built with C# .NET 8 WPF.
|
> A Windows desktop 3D viewer for STP/STEP CAD files — multi-file import, assembly tree, and point / distance / edge / face / circle measurement. Built with C# .NET 8 WPF.
|
||||||
|
|
||||||
   
|
   
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -28,30 +28,33 @@
|
|||||||
|
|
||||||
Open mechanical STEP parts for quick review and measurement without a heavyweight CAD suite (SolidWorks / Creo).
|
Open mechanical STEP parts for quick review and measurement without a heavyweight CAD suite (SolidWorks / Creo).
|
||||||
|
|
||||||
- **Multi-file import** — STEP / STL / DXF, via the toolbar (multi-select), drag-and-drop, or command line: `STPViewer.exe a.stp b.stl`
|
- **Multi-file import** — STEP / STL / DXF, via the toolbar (multi-select), drag-and-drop, command line (`STPViewer.exe a.stp b.stl`), or the recent-files dropdown (▾, last 10 files)
|
||||||
- **Assembly tree** — STEP product structure restored as a tree (assembly → part); per-node show/hide, recolor (cascades to children), zoom-to; file-level remove and outline-edge toggle
|
- **Assembly tree** — STEP product structure restored as a tree (assembly → part); per-node show/hide, recolor (cascades to children), zoom-to; file-level remove and outline-edge toggle; **name search filter**; right-click **Isolate / Invert visibility / Show all / Volume & centroid**; tooltips show each part's L×W×H
|
||||||
- **Measurement** (toolbar mode toggle, then click the model):
|
- **Measurement** (toolbar mode toggle or hotkey, then click the model):
|
||||||
|
|
||||||
| Mode | Output |
|
| Mode | Hotkey | Output |
|
||||||
|---|---|
|
|---|---|---|
|
||||||
| 📍 Point | XYZ coordinate (auto-snaps to nearby B-rep vertex) |
|
| 📍 Point | P | XYZ coordinate (auto-snaps to nearby B-rep vertex **or circle center**) |
|
||||||
| 📏 Distance | Straight-line distance + ΔX/ΔY/ΔZ |
|
| 📏 Distance | D | Straight-line distance + ΔX/ΔY/ΔZ — clicking two hole rims snaps to their **centers** = pin pitch |
|
||||||
| 📐 Edge | Line length / curve length / arc length + radius |
|
| 📐 Edge | E | Line length / curve length / arc length + radius |
|
||||||
| ⬛ Face | Area (mesh approximation) + surface type (plane normal, cylinder radius/axis) |
|
| ⬛ Face | F | Area (mesh approximation) + surface type (plane normal, cylinder radius/axis) |
|
||||||
| ⭕ Circle | Center / radius / diameter / circumference |
|
| ⭕ Circle | C | Center / radius / diameter / circumference |
|
||||||
| ∠ Angle | Angle between two faces (normals) or two straight edges + supplement |
|
| ∠ Angle | A | Angle between two faces (normals) or two straight edges + supplement |
|
||||||
| ⇔ Face distance | Shortest face-to-face distance (mesh approximation) + closest point pair |
|
| ⇔ Face distance | M | Shortest face-to-face distance (mesh approximation) + closest point pair |
|
||||||
| ⤚ Align (2-pt) | Pick a point on the moving part + a target point → pure translation so the two points coincide |
|
| ⚖ Volume | (tree right-click) | Mesh signed volume + centroid marker + bounding size (closed solids) |
|
||||||
| 🎯 Align (3-pt) | 3 source points + 3 target points → rotation + translation in one shot |
|
| ⤚ Align (2-pt) | | Pick a point on the moving part + a target point → pure translation so the two points coincide |
|
||||||
|
| 🎯 Align (3-pt) | | 3 source points + 3 target points → rotation + translation in one shot |
|
||||||
|
|
||||||
|
Press the same hotkey again to exit; **Esc** cancels an in-progress pick, then exits the mode.
|
||||||
- **Rotate** — select a file in the tree, then ↻X / ↻Y / ↻Z to rotate +90° about its center (for re-orienting; repeat to accumulate)
|
- **Rotate** — select a file in the tree, then ↻X / ↻Y / ↻Z to rotate +90° about its center (for re-orienting; repeat to accumulate)
|
||||||
- **Drag** 🖐 — hand-cursor mode; hold the left button to drag a part along the screen plane, release to place (right-button view orbit unaffected)
|
- **Drag** 🖐 — hand-cursor mode; hold the left button to drag a part along the screen plane, release to place (right-button view orbit unaffected)
|
||||||
- **Gizmo** ⊹ — select a file → XYZ tri-color arrows + rotation rings (Fusion 360 style); drag an arrow to move along that axis (view-independent), drag a ring to rotate. Always floats on top, never occluded
|
- **Gizmo** ⊹ — select a file → XYZ tri-color arrows + rotation rings (Fusion 360 style); drag an arrow to move along that axis (view-independent), drag a ring to rotate. Always floats on top, never occluded
|
||||||
- **Interference check** 🧩 — with exactly 2 visible files, shows red intersection curves + intersecting triangle-pair count; otherwise reports the minimum gap (gap ≈ 0 means a fit/match; coplanar contact is not interference)
|
- **Interference check** 🧩 — with 2+ visible files, checks **every pair**: red intersection curves + intersecting triangle-pair count, or the minimum gap (gap ≈ 0 means a fit/match; coplanar contact is not interference)
|
||||||
- **Section plane** ✂ — X/Y/Z axis + position slider + flip; CPU mesh clipping, original geometry preserved (measurement stays exact)
|
- **Section plane** ✂ — X/Y/Z axis **or an arbitrary plane picked from 3 points on the model**; position slider + numeric input + flip; CPU mesh clipping (parallel, in the background), original geometry preserved (measurement stays exact)
|
||||||
- **Units** — one-click mm ⇄ inch; existing measurements (list + 3D labels) convert live
|
- **Units** — one-click mm ⇄ inch; existing measurements (list + 3D labels) convert live
|
||||||
- **Export** — measurement results to CSV (UTF-8 BOM, no mojibake in Excel) and a 2× PNG screenshot of the 3D view
|
- **Export** — measurement results to CSV (UTF-8 BOM, no mojibake in Excel), a 2× PNG screenshot, and 📤 **STEP export**: writes all visible parts at their current aligned positions into a new STEP file (originals untouched)
|
||||||
- **View** — right-button orbit, wheel zoom, middle-button pan, ViewCube
|
- **View** — right-button orbit, wheel zoom, middle-button pan, ViewCube; one-click **Iso / Front / Top / Right** views and an **orthographic ⇄ perspective** toggle
|
||||||
|
- **Remembers your setup** — window size/position, unit choice and recent files persist across sessions; side panels are resizable
|
||||||
|
|
||||||
Measurement principle: edge length, circle radius and angles use **exact B-rep values**; area is a triangle-mesh sum approximation (triangulation precision adapts to model size, 0.02–0.5 mm).
|
Measurement principle: edge length, circle radius and angles use **exact B-rep values**; area is a triangle-mesh sum approximation (triangulation precision adapts to model size, 0.02–0.5 mm).
|
||||||
|
|
||||||
@@ -71,8 +74,8 @@ Measurement principle: edge length, circle radius and angles use **exact B-rep v
|
|||||||
|
|
||||||
Download a release build and run it — no install required.
|
Download a release build and run it — no install required.
|
||||||
|
|
||||||
- **Framework-dependent** (smaller): requires the .NET 8 Desktop Runtime. Run `STPViewer v0.3.2.exe`.
|
- **Framework-dependent** (smaller): requires the .NET 8 Desktop Runtime. Run `STPViewer v0.5.0.exe`.
|
||||||
- **Portable** (self-contained): runtime bundled, no install / admin. Run `STPViewer v0.3.2.exe`.
|
- **Portable** (self-contained): runtime bundled, no install / admin. Run `STPViewer v0.5.0.exe`.
|
||||||
|
|
||||||
Or build from source (see below).
|
Or build from source (see below).
|
||||||
|
|
||||||
@@ -102,11 +105,11 @@ Then import a `.stp` file (toolbar **Import**, drag-and-drop, or command-line ar
|
|||||||
## 📚 Usage Guide
|
## 📚 Usage Guide
|
||||||
|
|
||||||
1. **Import** one or more CAD files. Each file becomes a root in the assembly tree and the view zooms to fit.
|
1. **Import** one or more CAD files. Each file becomes a root in the assembly tree and the view zooms to fit.
|
||||||
2. **Navigate** the tree — toggle visibility, recolor, zoom to a node, or remove a file.
|
2. **Navigate** the tree — search by name, toggle visibility (or right-click → Isolate), recolor, zoom to a node, or remove a file.
|
||||||
3. **Measure** — pick a mode on the toolbar (Point / Distance / Edge / Face / Circle / Angle / Face-distance), then click the model. Results appear in the right-hand panel; delete individually or clear all.
|
3. **Measure** — pick a mode on the toolbar or by hotkey (P/D/E/F/C/A/M), then click the model. Clicking near a hole rim snaps to the circle center — two clicks measure a pin pitch. Esc cancels. Results appear in the right-hand panel; delete individually or clear all.
|
||||||
4. **Assemble** — use Align (2-pt / 3-pt), Rotate, Drag, or the Gizmo to position parts; then run the Interference check to verify fit.
|
4. **Assemble** — use Align (2-pt / 3-pt), Rotate, Drag, or the Gizmo to position parts; then run the Interference check (any number of visible files, all pairs) to verify fit.
|
||||||
5. **Section** — toggle ✂, choose an axis, and slide to cut through the model; measurement stays exact on the original geometry.
|
5. **Section** — toggle ✂, choose an axis or pick 3 points for an arbitrary plane, and slide (or type a %) to cut through the model; measurement stays exact on the original geometry.
|
||||||
6. **Export** — save measurements to CSV or capture a 2× PNG of the view.
|
6. **Export** — save measurements to CSV, capture a 2× PNG, or write the aligned scene to a new STEP file for hand-off to CAD.
|
||||||
|
|
||||||
Headless import-pipeline and geometry-math verification (no UI):
|
Headless import-pipeline and geometry-math verification (no UI):
|
||||||
|
|
||||||
@@ -115,6 +118,7 @@ dotnet run --project tools/SmokeTest -- "path\to\model.stp" # import + assembl
|
|||||||
dotnet run --project tools/SmokeTest -- --clip-test # section clipping math
|
dotnet run --project tools/SmokeTest -- --clip-test # section clipping math
|
||||||
dotnet run --project tools/SmokeTest -- --interference-test # interference: intersect / separate / contact
|
dotnet run --project tools/SmokeTest -- --interference-test # interference: intersect / separate / contact
|
||||||
dotnet run --project tools/SmokeTest -- --align-test # 3-point rigid-transform math
|
dotnet run --project tools/SmokeTest -- --align-test # 3-point rigid-transform math
|
||||||
|
dotnet run --project tools/SmokeTest -- --export-test in.stp out.stp # STEP export round-trip
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -142,8 +146,8 @@ STPViewer/
|
|||||||
│ ├── STPViewer.csproj # net8.0-windows, UseWPF, single-source <Version>
|
│ ├── STPViewer.csproj # net8.0-windows, UseWPF, single-source <Version>
|
||||||
│ ├── MainWindow.xaml / .cs # Layout + mouse-pick forwarding
|
│ ├── MainWindow.xaml / .cs # Layout + mouse-pick forwarding
|
||||||
│ ├── Models/ # FaceInfo, MeasureMode, MeasurementResult, UnitSystem
|
│ ├── Models/ # FaceInfo, MeasureMode, MeasurementResult, UnitSystem
|
||||||
│ ├── Services/ # StepImport, Measurement, Interference, Section, RigidAlign
|
│ ├── Services/ # StepImport, Measurement, Interference, Section, RigidAlign, Settings
|
||||||
│ └── ViewModels/ # MainViewModel, ModelNodeViewModel (assembly tree)
|
│ └── ViewModels/ # MainViewModel (partial: Drag/Gizmo/Section/Interference/Export), ModelNodeViewModel
|
||||||
└── tools/SmokeTest/ # Headless import + geometry-math verification
|
└── tools/SmokeTest/ # Headless import + geometry-math verification
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -155,7 +159,8 @@ STPViewer/
|
|||||||
- Files with more than 30,000 outline segments disable edges by default (WPF `LinesVisual3D` cost while orbiting); re-enable per file in the tree.
|
- Files with more than 30,000 outline segments disable edges by default (WPF `LinesVisual3D` cost while orbiting); re-enable per file in the tree.
|
||||||
- **IGES is not supported** (CADability has no IGES reader). STL has no B-rep (point / distance / angle / face-distance only). DXF is wireframe view.
|
- **IGES is not supported** (CADability has no IGES reader). STL has no B-rep (point / distance / angle / face-distance only). DXF is wireframe view.
|
||||||
- Section cuts have no cap fill — the opened face shows the interior back material (dark gray).
|
- Section cuts have no cap fill — the opened face shows the interior back material (dark gray).
|
||||||
- Area and face-distance are mesh approximations; edge length / circle radius / angle are exact B-rep values.
|
- STEP export writes the solids/shells at their current positions as a flat list — the original assembly hierarchy and product names are not preserved. STL meshes and DXF wireframes are not exported (no B-rep).
|
||||||
|
- Area, face-distance and volume/centroid are mesh approximations; edge length / circle radius / angle are exact B-rep values.
|
||||||
- A few AP242 files are incompletely supported by CADability; failed imports show a message (no crash).
|
- A few AP242 files are incompletely supported by CADability; failed imports show a message (no crash).
|
||||||
- Read-only viewer — never writes to or modifies the source file.
|
- Read-only viewer — never writes to or modifies the source file.
|
||||||
|
|
||||||
@@ -171,6 +176,15 @@ STPViewer/
|
|||||||
|
|
||||||
## 📜 Version History
|
## 📜 Version History
|
||||||
|
|
||||||
|
### v0.5.0
|
||||||
|
|
||||||
|
- **Feature round:** circle-center snap (measure hole-to-hole pitch in two clicks), measurement hotkeys (P/D/E/F/C/A/M) + Esc, standard views (Iso/Front/Top/Right) + orthographic projection, assembly-tree search / isolate / invert, volume & centroid, 3-point arbitrary section plane + numeric position input, interference check across 3+ files (all pairs), STEP export of the aligned scene, resizable panels, and persisted window / unit / recent-files settings.
|
||||||
|
|
||||||
|
### v0.4.0
|
||||||
|
|
||||||
|
- **Perf:** section clipping now runs parallel in the background (no more UI freeze while dragging the slider on large files); part-transform bake (drag/gizmo release) parallelized; interference gap refinement accelerated with AABB early rejection.
|
||||||
|
- **Stability:** global exception handling (log to `%LOCALAPPDATA%\STPViewer\error.log` + message box instead of crashing); geometry-mutating commands disabled while a background computation runs; import reentrancy guarded.
|
||||||
|
|
||||||
### v0.3.2
|
### v0.3.2
|
||||||
|
|
||||||
- **Perf:** large-assembly measurement no longer lags while orbiting. Measurement modes now render the merged mesh (one model per file) and resolve the picked face from the hit triangle's vertex index, instead of rendering tens of thousands of per-face models. Per-face rendering is kept only for section mode.
|
- **Perf:** large-assembly measurement no longer lags while orbiting. Measurement modes now render the merged mesh (one model per file) and resolve the picked face from the hit triangle's vertex index, instead of rendering tens of thousands of per-face models. Per-face rendering is kept only for section mode.
|
||||||
|
|||||||
+43
-29
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
> STP/STEP 3D 檢視器(Windows 桌面程式,C# .NET 8 WPF)— 多檔匯入、裝配樹、點/距離/邊/面/圓量測。
|
> STP/STEP 3D 檢視器(Windows 桌面程式,C# .NET 8 WPF)— 多檔匯入、裝配樹、點/距離/邊/面/圓量測。
|
||||||
|
|
||||||
   
|
   
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -28,30 +28,33 @@
|
|||||||
|
|
||||||
快速開啟機構件 STEP 檔做確認與量測,不需安裝 SolidWorks / Creo 等重量級 CAD。
|
快速開啟機構件 STEP 檔做確認與量測,不需安裝 SolidWorks / Creo 等重量級 CAD。
|
||||||
|
|
||||||
- **多檔匯入** — STEP / STL / DXF,工具列匯入(可複選)、拖放到視窗,或命令列 `STPViewer.exe a.stp b.stl`
|
- **多檔匯入** — STEP / STL / DXF,工具列匯入(可複選)、拖放到視窗、命令列 `STPViewer.exe a.stp b.stl`,或最近檔案下拉(▾,最近 10 筆)
|
||||||
- **裝配樹** — STEP product structure 還原成樹(組件→零件);逐節點 顯示/隱藏、換色(cascade)、Zoom-to;檔案層級可移除、開關輪廓邊線
|
- **裝配樹** — STEP product structure 還原成樹(組件→零件);逐節點 顯示/隱藏、換色(cascade)、Zoom-to;檔案層級可移除、開關輪廓邊線;**名稱搜尋過濾**;右鍵 **只顯示此節點 / 反轉顯示 / 全部顯示 / 量體積質心**;tooltip 顯示外形尺寸 L×W×H
|
||||||
- **量測**(工具列切換模式,點擊模型):
|
- **量測**(工具列切換模式或快速鍵,點擊模型):
|
||||||
|
|
||||||
| 模式 | 輸出 |
|
| 模式 | 快速鍵 | 輸出 |
|
||||||
|---|---|
|
|---|---|---|
|
||||||
| 📍 點 | XYZ 座標(自動吸附鄰近 B-rep 頂點) |
|
| 📍 點 | P | XYZ 座標(自動吸附鄰近 B-rep 頂點**或圓心**) |
|
||||||
| 📏 距離 | 兩點直線距離 + ΔX/ΔY/ΔZ |
|
| 📏 距離 | D | 兩點直線距離 + ΔX/ΔY/ΔZ — 點兩個孔緣即吸附**圓心**=直接量 pin pitch |
|
||||||
| 📐 邊 | 直線長 / 曲線長 / 圓弧長 + 半徑 |
|
| 📐 邊 | E | 直線長 / 曲線長 / 圓弧長 + 半徑 |
|
||||||
| ⬛ 面 | 面積(網格近似)+ 曲面類型(平面法向量、圓柱半徑/軸向) |
|
| ⬛ 面 | F | 面積(網格近似)+ 曲面類型(平面法向量、圓柱半徑/軸向) |
|
||||||
| ⭕ 圓 | 圓心 / 半徑 / 直徑 / 周長 |
|
| ⭕ 圓 | C | 圓心 / 半徑 / 直徑 / 周長 |
|
||||||
| ∠ 角度 | 兩面(法向量)/ 兩直線邊 夾角 + 補角 |
|
| ∠ 角度 | A | 兩面(法向量)/ 兩直線邊 夾角 + 補角 |
|
||||||
| ⇔ 面距 | 面到面最短距離(網格近似)+ 最近點對 |
|
| ⇔ 面距 | M | 面到面最短距離(網格近似)+ 最近點對 |
|
||||||
| ⤚ 對齊(兩點) | 點「要移動零件」一點 + 目標點 → 純平移使兩點貼合 |
|
| ⚖ 體積 | (樹右鍵) | 網格 signed volume + 質心標記 + 外形尺寸(封閉實體) |
|
||||||
| 🎯 對齊(三點) | 來源檔 3 點 + 目標檔 3 對應點 → 旋轉+平移一次貼合 |
|
| ⤚ 對齊(兩點) | | 點「要移動零件」一點 + 目標點 → 純平移使兩點貼合 |
|
||||||
|
| 🎯 對齊(三點) | | 來源檔 3 點 + 目標檔 3 對應點 → 旋轉+平移一次貼合 |
|
||||||
|
|
||||||
|
同鍵再按 = 退出模式;**Esc** 先取消進行中的點選、再按退出模式。
|
||||||
- **旋轉** — 樹面板選檔案 + 工具列 ↻X/↻Y/↻Z 繞中心 +90°(擺正方向用,連按累加)
|
- **旋轉** — 樹面板選檔案 + 工具列 ↻X/↻Y/↻Z 繞中心 +90°(擺正方向用,連按累加)
|
||||||
- **拖曳** 🖐 — 手形游標模式,左鍵按住零件沿螢幕平面拖動、放開定位(右鍵轉視角不受影響)
|
- **拖曳** 🖐 — 手形游標模式,左鍵按住零件沿螢幕平面拖動、放開定位(右鍵轉視角不受影響)
|
||||||
- **操作器** ⊹ — 樹面板選檔案 → XYZ 三色箭頭 + 旋轉環(Fusion 360 風格);拖箭頭沿該軸移動(與視角無關)、拖環繞軸轉。永遠浮在最上層、不被實體遮擋
|
- **操作器** ⊹ — 樹面板選檔案 → XYZ 三色箭頭 + 旋轉環(Fusion 360 風格);拖箭頭沿該軸移動(與視角無關)、拖環繞軸轉。永遠浮在最上層、不被實體遮擋
|
||||||
- **干涉檢查** 🧩 — 勾選剛好 2 個可見檔案 → 相交時顯示紅色干涉交線 + 相交三角形對數;無相交時回報最小間隙 gap(gap≈0 即為配合 match,共面貼合不算干涉)
|
- **干涉檢查** 🧩 — 2 個以上可見檔案**兩兩配對**檢查:相交時顯示紅色干涉交線 + 相交三角形對數;無相交時回報最小間隙 gap(gap≈0 即為配合 match,共面貼合不算干涉)
|
||||||
- **剖面** ✂ — X/Y/Z 軸 + 位置滑桿 + 反向;CPU 網格裁切,原始幾何保留(量測仍精確)
|
- **剖面** ✂ — X/Y/Z 軸或**在模型上點 3 點定義任意平面**;位置滑桿 + 數值輸入 + 反向;CPU 網格裁切(背景平行運算),原始幾何保留(量測仍精確)
|
||||||
- **單位** — mm ⇄ inch 一鍵切換,既有量測(清單與 3D 標籤)即時換算
|
- **單位** — mm ⇄ inch 一鍵切換,既有量測(清單與 3D 標籤)即時換算
|
||||||
- **匯出** — 量測結果 CSV(UTF-8 BOM,Excel 中文不亂碼)、3D 視圖 2× PNG 截圖
|
- **匯出** — 量測結果 CSV(UTF-8 BOM,Excel 中文不亂碼)、3D 視圖 2× PNG 截圖、📤 **STEP 匯出**:可見零件以目前對齊位置寫成新 STEP 檔(原始檔不動)
|
||||||
- **視角** — 右鍵旋轉、滾輪縮放、中鍵平移、ViewCube
|
- **視角** — 右鍵旋轉、滾輪縮放、中鍵平移、ViewCube;一鍵 **等角/前/上/右** 標準視圖與 **正交⇄透視** 切換
|
||||||
|
- **記住設定** — 視窗位置大小、單位、最近檔案自動保存;左右面板可拖曳調寬
|
||||||
|
|
||||||
量測原則:邊長、圓半徑、角度取 **B-rep 精確值**;面積為三角網格加總近似(三角化精度依模型尺寸自適應 0.02–0.5 mm)。
|
量測原則:邊長、圓半徑、角度取 **B-rep 精確值**;面積為三角網格加總近似(三角化精度依模型尺寸自適應 0.02–0.5 mm)。
|
||||||
|
|
||||||
@@ -71,8 +74,8 @@
|
|||||||
|
|
||||||
下載發佈版直接執行,免安裝。
|
下載發佈版直接執行,免安裝。
|
||||||
|
|
||||||
- **框架相依版**(檔案較小):需 .NET 8 Desktop Runtime,執行 `STPViewer v0.3.2.exe`。
|
- **框架相依版**(檔案較小):需 .NET 8 Desktop Runtime,執行 `STPViewer v0.5.0.exe`。
|
||||||
- **Portable 版**(self-contained):內含 runtime,免安裝 / 免系統管理員,執行 `STPViewer v0.3.2.exe`。
|
- **Portable 版**(self-contained):內含 runtime,免安裝 / 免系統管理員,執行 `STPViewer v0.5.0.exe`。
|
||||||
|
|
||||||
或從原始碼建置(見下)。
|
或從原始碼建置(見下)。
|
||||||
|
|
||||||
@@ -102,11 +105,11 @@ dotnet publish src/STPViewer -c Release -o publish/STPViewer
|
|||||||
## 📚 使用指南
|
## 📚 使用指南
|
||||||
|
|
||||||
1. **匯入** 一個或多個 CAD 檔,每個檔案成為裝配樹的一個 root,視角自動 Zoom 到全景。
|
1. **匯入** 一個或多個 CAD 檔,每個檔案成為裝配樹的一個 root,視角自動 Zoom 到全景。
|
||||||
2. **操作樹** — 顯示/隱藏、換色、Zoom-to 某節點,或移除檔案。
|
2. **操作樹** — 名稱搜尋、顯示/隱藏(或右鍵隔離顯示)、換色、Zoom-to 某節點,或移除檔案。
|
||||||
3. **量測** — 工具列選模式(點 / 距離 / 邊 / 面 / 圓 / 角度 / 面距),點擊模型;結果顯示於右側面板,可單筆刪除或全部清除。
|
3. **量測** — 工具列選模式或按快速鍵(P/D/E/F/C/A/M),點擊模型;點孔緣自動吸圓心,兩下就是 pin pitch;Esc 取消。結果顯示於右側面板,可單筆刪除或全部清除。
|
||||||
4. **裝配** — 用 對齊(兩點/三點)、旋轉、拖曳、操作器擺位,再用干涉檢查驗證配合。
|
4. **裝配** — 用 對齊(兩點/三點)、旋轉、拖曳、操作器擺位,再用干涉檢查(可見檔全部兩兩檢查)驗證配合。
|
||||||
5. **剖面** — 開啟 ✂、選軸向、滑動剖切;量測仍以原始幾何精確計算。
|
5. **剖面** — 開啟 ✂、選軸向或點 3 點定義任意平面、滑動(或輸入 %)剖切;量測仍以原始幾何精確計算。
|
||||||
6. **匯出** — 量測結果存 CSV,或截 2× PNG。
|
6. **匯出** — 量測結果存 CSV、截 2× PNG,或把對齊後的場景寫成新 STEP 檔交接給 CAD。
|
||||||
|
|
||||||
無 UI 匯入管線與幾何數學驗證:
|
無 UI 匯入管線與幾何數學驗證:
|
||||||
|
|
||||||
@@ -115,6 +118,7 @@ dotnet run --project tools/SmokeTest -- "path\to\model.stp" # 匯入 + 裝配
|
|||||||
dotnet run --project tools/SmokeTest -- --clip-test # 剖切裁切數學
|
dotnet run --project tools/SmokeTest -- --clip-test # 剖切裁切數學
|
||||||
dotnet run --project tools/SmokeTest -- --interference-test # 干涉 相交/分離/貼合
|
dotnet run --project tools/SmokeTest -- --interference-test # 干涉 相交/分離/貼合
|
||||||
dotnet run --project tools/SmokeTest -- --align-test # 三點對齊剛體變換數學
|
dotnet run --project tools/SmokeTest -- --align-test # 三點對齊剛體變換數學
|
||||||
|
dotnet run --project tools/SmokeTest -- --export-test in.stp out.stp # STEP 匯出往返驗證
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -142,8 +146,8 @@ STPViewer/
|
|||||||
│ ├── STPViewer.csproj # net8.0-windows、UseWPF、單一版號來源 <Version>
|
│ ├── STPViewer.csproj # net8.0-windows、UseWPF、單一版號來源 <Version>
|
||||||
│ ├── MainWindow.xaml / .cs # 版面 + 滑鼠拾取轉發
|
│ ├── MainWindow.xaml / .cs # 版面 + 滑鼠拾取轉發
|
||||||
│ ├── Models/ # FaceInfo、MeasureMode、MeasurementResult、UnitSystem
|
│ ├── Models/ # FaceInfo、MeasureMode、MeasurementResult、UnitSystem
|
||||||
│ ├── Services/ # StepImport、Measurement、Interference、Section、RigidAlign
|
│ ├── Services/ # StepImport、Measurement、Interference、Section、RigidAlign、Settings
|
||||||
│ └── ViewModels/ # MainViewModel、ModelNodeViewModel(裝配樹)
|
│ └── ViewModels/ # MainViewModel(partial:Drag/Gizmo/Section/Interference/Export)、ModelNodeViewModel
|
||||||
└── tools/SmokeTest/ # 無 UI 匯入 + 幾何數學驗證
|
└── tools/SmokeTest/ # 無 UI 匯入 + 幾何數學驗證
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -155,7 +159,8 @@ STPViewer/
|
|||||||
- 輪廓邊線超過 30,000 線段的檔案預設關閉邊線(WPF `LinesVisual3D` 轉動視角時效能限制),可在樹面板手動開啟。
|
- 輪廓邊線超過 30,000 線段的檔案預設關閉邊線(WPF `LinesVisual3D` 轉動視角時效能限制),可在樹面板手動開啟。
|
||||||
- **IGES 不支援**(CADability 無 IGES reader);STL 無 B-rep,僅支援 點/距離/角度/面距 量測;DXF 為線架構檢視。
|
- **IGES 不支援**(CADability 無 IGES reader);STL 無 B-rep,僅支援 點/距離/角度/面距 量測;DXF 為線架構檢視。
|
||||||
- 剖切面無封口(cap),剖開處顯示內部背面材質(深灰)。
|
- 剖切面無封口(cap),剖開處顯示內部背面材質(深灰)。
|
||||||
- 面積與面距為三角網格近似值;邊長/圓半徑/角度為 B-rep 精確值。
|
- STEP 匯出為「目前位置的 Solid/Shell 平面清單」,不保留原始裝配階層與 product 名稱;STL 網格、DXF 線架構無 B-rep 不匯出。
|
||||||
|
- 面積、面距、體積/質心為三角網格近似值;邊長/圓半徑/角度為 B-rep 精確值。
|
||||||
- 少數 AP242 檔案 CADability 支援不完整,匯入失敗會提示訊息(不閃退)。
|
- 少數 AP242 檔案 CADability 支援不完整,匯入失敗會提示訊息(不閃退)。
|
||||||
- 唯讀檢視器,不寫入/修改原始檔案。
|
- 唯讀檢視器,不寫入/修改原始檔案。
|
||||||
|
|
||||||
@@ -171,6 +176,15 @@ STPViewer/
|
|||||||
|
|
||||||
## 📜 版本紀錄
|
## 📜 版本紀錄
|
||||||
|
|
||||||
|
### v0.5.0
|
||||||
|
|
||||||
|
- **功能擴充:** 圓心吸附(兩下量孔對孔 pitch)、量測快速鍵(P/D/E/F/C/A/M)+ Esc、標準視圖(等角/前/上/右)+ 正交投影、裝配樹搜尋/隔離顯示/反轉、體積與質心、3點任意剖切平面 + 位置數值輸入、干涉檢查支援 3+ 檔(兩兩配對)、對齊後場景匯出 STEP、面板可調寬、視窗/單位/最近檔案自動保存。
|
||||||
|
|
||||||
|
### v0.4.0
|
||||||
|
|
||||||
|
- **效能:** 剖面裁切改背景平行運算(大檔拉滑桿不再凍結 UI);零件變換烘焙(拖曳/操作器放開)平行化;干涉間隙精修以 AABB 快速拒絕加速。
|
||||||
|
- **穩定性:** 全域例外處理(記 log 至 `%LOCALAPPDATA%\STPViewer\error.log` + 訊息框,不閃退);背景運算期間停用會改動幾何的指令;匯入防重入。
|
||||||
|
|
||||||
### v0.3.2
|
### v0.3.2
|
||||||
|
|
||||||
- **效能:** 大組件量測模式下轉動視角不再卡頓。量測模式改為渲染合併網格(每檔 1 個 model),並用命中三角形的頂點 index 反查回是哪個面,不再掛數萬個逐面 model;逐面渲染只保留給剖面模式。
|
- **效能:** 大組件量測模式下轉動視角不再卡頓。量測模式改為渲染合併網格(每檔 1 個 model),並用命中三角形的頂點 index 反查回是哪個面,不再掛數萬個逐面 model;逐面渲染只保留給剖面模式。
|
||||||
|
|||||||
Reference in New Issue
Block a user