Files
2026-07-17 17:45:56 +08:00

64 lines
2.4 KiB
Markdown

# ModelDiagnosticVerifier
Verifies product models against rule packages generated by `RuleTemplateGenerator`.
## Responsibility
`ModelDiagnosticVerifier` handles only model-side diagnosis:
- input: a SolidWorks model path or an existing model evidence JSON
- input: a rule package JSON
- output: `not_applicable`, `pass`, `problem`, or `needs_review`
- it does not interpret teaching images/text
- it does not invent new rules
## Pipeline
```text
SolidWorks model
-> 3D B-rep / structural raw evidence
-> section 2D structure instance
-> scene candidates
-> rule applicability
-> image 2D structure template matching
-> real geometry/contact validation
-> final diagnosis
```
Current implementation can consume existing evidence JSON. If a `.SLDASM` or `.SLDPRT` is passed, it tries to run:
- `tools\model-diagnostics\SectionBrepExtractor`: extracts section sketch graph evidence such as edges, relations, dimensions, regions, and semantic roles.
- `tools\model-diagnostics\StructuralFaultProbe`: extracts assembly structure evidence such as components, axial contacts, bearing limits, and fixation information.
The verifier then normalizes and merges these sources before matching rule templates.
## Evidence Discipline
The verifier must not treat "no direct relation matched" as immediate failure. For every pass template it reports:
- model evidence found and missing
- 2D structure relations found and missing
- `found`, `candidate`, or `missing` status
This is important because image templates and model evidence usually do not use identical names. Low-level extractor facts may need explicit promotion before they satisfy a higher-level rule evidence type.
## Usage
Verify from an existing evidence JSON:
```powershell
dotnet run --project tools\model-diagnostics\ModelDiagnosticVerifier\ModelDiagnosticVerifier.csproj -c Release -- verify --model runtime\structural_fault_probe\structural_fault_evidence.json --rules runtime\rule_templates\tight_fit_sleeve_requires_disassembly_access.json --out runtime\diagnostics\sleeve_check
```
Verify directly from a SolidWorks assembly:
```powershell
dotnet run --project tools\model-diagnostics\ModelDiagnosticVerifier\ModelDiagnosticVerifier.csproj -c Release -- verify --model "D:\path\assembly.SLDASM" --rules runtime\rule_templates\tight_fit_sleeve_requires_disassembly_access.json --out runtime\diagnostics\sleeve_check
```
Output:
- `<out>.json`
- `<out>.md`