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

3.8 KiB

BrepFaultProbe

Formal entry point for B-rep based structural fault diagnosis experiments.

This tool collects the current B-rep fault-checking workflow behind one stable command surface:

  • model: extract a true SolidWorks section B-rep and canonical 2D sketch graph.
  • bridge / interpret: convert a SolidWorks model into a B-rep semantic bridge package, render SVG, patch map, local feature candidates, self-evolution audit, and optional AI interpretation.
  • diagnose-ch18: run the formal Chapter 18 trial workflow for verified chunks 18.2.1 and 18.2.4. It first builds a semantic bridge, matches the mechanical semantic graph against the two chunks, and if a possible match is blocked by missing B-rep-extractable facts, it runs targeted deep extraction before writing the final match.

The formal model-side section extraction implementation is tools\model-diagnostics\SectionBrepExtractor. Old temporary wrappers that referenced tmp have been removed from this entry point.

Examples:

dotnet run --project tools\model-diagnostics\BrepFaultProbe\BrepFaultProbe.csproj -c Release -- model "D:\path\model.SLDASM"
dotnet run --project tools\model-diagnostics\BrepFaultProbe\BrepFaultProbe.csproj -c Release -- bridge "D:\path\model.SLDASM" runtime\brep_semantic_bridge\trial1
dotnet run --project tools\model-diagnostics\BrepFaultProbe\BrepFaultProbe.csproj -c Release -- diagnose-ch18 "D:\path\model.SLDASM" runtime\knowledge_diagnosis_ch18\trial1

bridge writes these files:

  • structure_graph.json: unified 2D B-rep, extracted relations, dimensions, 3D component/cylinder facts, and interpretation contract.
  • patch_map.json: grid patches over the 2D B-rep render, with edge/owner/role references per patch.
  • render.svg: a drawable 2D projection of the B-rep structure for visual grounding.
  • semantic_bridge_package.json: model-ready payload combining the structure graph and render reference.
  • prompt.md: the exact text prompt used for model interpretation.
  • ai_interpretation.md: written only when OPENAI_API_KEY is set and the configured AI chat API call succeeds.

diagnose-ch18 writes these files:

  • initial/: first-pass bridge output.
  • knowledge_match.initial.json: first-pass match against 18.2.1 and 18.2.4.
  • final/: deep bridge output, written when a possible match needs more B-rep facts.
  • knowledge_match.final.json: final match result.
  • diagnosis_manifest.json: process manifest, including whether targeted re-extraction was performed.

Optional AI settings:

$env:OPENAI_API_KEY = "..."
$env:OPENAI_MODEL = "qwen-vl-max"
$env:OPENAI_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1"
$env:OPENAI_API_MODE = "chat_completions"
$env:OPENAI_MAX_IMAGES = "12"
dotnet run --project tools\model-diagnostics\BrepFaultProbe\BrepFaultProbe.csproj -c Release -- bridge "D:\path\model.SLDASM"
dotnet run --project tools\model-diagnostics\BrepFaultProbe\BrepFaultProbe.csproj -c Release -- bridge "D:\path\model.SLDASM" --model qwen-vl-max --max-iterations 2
dotnet run --project tools\model-diagnostics\BrepFaultProbe\BrepFaultProbe.csproj -c Release -- bridge "D:\path\model.SLDASM" --deep --no-ai

Self-evolution behavior:

  • The bridge first audits local fact coverage: section count, contact relations, outside-adjacent edges, component facts, and cylindrical faces.
  • If local coverage is weak, or --deep is passed, it automatically adds secondary section views with different guide axes.
  • The structure package includes SelfEvolutionAudit, SectionViews, and LocalFeatureCandidates.
  • When AI is enabled, the prompt requires a final JSON self-evolution request. If the model says more facts are needed, the tool performs one more interpretation pass using the enhanced package context and writes ai_self_evolution.json.