109 lines
7.5 KiB
Markdown
109 lines
7.5 KiB
Markdown
# SectionBrepExtractor
|
|
|
|
Temporary extractor for true section B-rep evidence.
|
|
|
|
Goal:
|
|
|
|
1. Use a chosen section plane.
|
|
2. Intersect SolidWorks bodies with that plane using official API hooks.
|
|
3. Convert the section result into a 2D B-rep-style evidence object: faces, edges, loops, and component provenance.
|
|
|
|
This is the layer that will eventually compare a textbook section image's lines against a model's section B-rep.
|
|
|
|
Run:
|
|
|
|
```powershell
|
|
dotnet run --project tools\model-diagnostics\SectionBrepExtractor\SectionBrepExtractor.csproj -c Release -- "D:\path\model.SLDASM"
|
|
```
|
|
|
|
Optionally export model-view JPG images during the same run:
|
|
|
|
```powershell
|
|
dotnet run --project tools\model-diagnostics\SectionBrepExtractor\SectionBrepExtractor.csproj -c Release -- "D:\path\model.SLDASM" --output-dir runtime\section_brep\trial1 --export-images
|
|
```
|
|
|
|
When `--image-views` is omitted, the tool exports seven baseline views:
|
|
`front,back,top,bottom,left,right,isometric`.
|
|
|
|
Section B-rep and section image export are disabled in the current workflow. Use assembly/component B-rep, component highlight images, part-file images, and internal component group context images instead.
|
|
|
|
Image export is implemented in `ModelImageExporter.cs`, separate from the B-rep extraction logic in `Program.cs`.
|
|
|
|
Image evidence families are hard workflow boundaries:
|
|
|
|
- `assembly_component_position`: component position and whole-component function only. It has two visibility variants:
|
|
- `unobstructed` (`assembly_component_highlight_view`): the assembly's existing visibility state is preserved and the target instance is highlighted in place. The exporter hides no component in this mode.
|
|
- `occluded_context` (`assembly_component_context_isolate_view`): only geometry-derived occlusion blockers are hidden. Direct contact or mate neighbors are always preserved, and unrelated non-blocking components keep their original visibility.
|
|
These are complementary renderings of the same evidence family, not component evidence versus interface evidence. Use the first whenever the target is already readable in the assembly; use the second only for an actually occluded internal target.
|
|
- `assembly_physical_interface` (`assembly_physical_interface_view`): physical contact/fit function only. Images isolate exactly two participating components and highlight the grouped interface faces. They must not be used as component-position or per-face part evidence.
|
|
Planar interface facts are retained in the B-rep report, but ordinary single-plane contacts are not exported as `physical_interfaces` images because they are not fit-tolerance evidence. Planar interface images are only for multi-face/profile fits such as slots, keys, or prismatic locating contacts. Cylindrical interface images first require analytic cylinder axis, radius, and axial-range compatibility. The common axial range is checked in 2 mm slices; for each slice the actual angular intervals are obtained from the SolidWorks trimmed Face and its Loop/Edge boundaries, without face tessellation or triangle-grid overlap. One slice with a positive angular interval intersection is sufficient; no minimum overlap-area threshold is applied. Opposing face normals are still required so two exterior faces on the same theoretical cylinder are not treated as a hole/shaft fit.
|
|
- `part_all_face_surface` (`functional_group_all_face_highlight`): post-functional-group part and surface diagnosis only. These images must not enter component-function or interface-function analysis.
|
|
- `part_feature_surface` (`part_feature_highlight_view`): direct-part feature evidence only.
|
|
|
|
`ImageKind` remains the concrete renderer/output type for compatibility. `EvidenceFamily` controls which AI stage may consume an image. Do not route images by filename alone.
|
|
|
|
Outputs:
|
|
|
|
- `section_brep_report.json`: assembly/component B-rep facts, face/contact facts, `FeatureGraph`, `SemanticFusionContract`, optional `ImageExport`, and empty legacy section fields.
|
|
- `section_brep_report.md`: readable summary with exported image paths.
|
|
- `model_images\*.jpg`: SolidWorks standard-view and section-view screenshots when image export is enabled.
|
|
|
|
Supported image views:
|
|
|
|
- `front`
|
|
- `back`
|
|
- `left`
|
|
- `right`
|
|
- `top`
|
|
- `bottom`
|
|
- `isometric`
|
|
- `trimetric`
|
|
- `dimetric`
|
|
|
|
Supported section planes:
|
|
|
|
- `front`
|
|
- `top`
|
|
- `right`
|
|
|
|
Feature graph:
|
|
|
|
The extractor also emits `FeatureGraph` as the B-rep side of the image/B-rep fusion layer. The first version groups raw faces into:
|
|
|
|
- `hole_group` / `hole_feature`
|
|
- `main_axis_cylindrical_surface_group`
|
|
- `cylindrical_surface_group`
|
|
- `planar_pad_step_or_face_candidate`
|
|
- assembly contact features when contacts exist
|
|
|
|
Each feature keeps source face refs and lists `VisualObservationNeeds` plus `RequiredBrepChecks` so AI diagnostics can combine image cues with measurable B-rep facts instead of treating either source as absolute.
|
|
|
|
Semantic fusion contract:
|
|
|
|
The extractor emits `SemanticFusionContract` as the machine-readable instruction boundary for AI diagnosis. It does not generate final mechanical semantics in code. Instead, it defines:
|
|
|
|
- the required pipeline from B-rep facts and images to a global mechanical semantic graph, then to local semantic units;
|
|
- supported B-rep feature types;
|
|
- semantic assertion types such as `part_identity`, `structural_semantic`, `functional_semantic`, `manufacturing_semantic`, `assembly_semantic`, and `risk_semantic`;
|
|
- retrieval views, local semantic unit schema, B-rep fact bundle schema, confidence/status policy, missing-check fields, retrieval policy, and dedup policy.
|
|
|
|
At diagnosis time, the AI uses this contract plus `FeatureGraph`, raw B-rep facts, standard images, and section images to generate the actual mechanical semantic graph. Then it generates knowledge-blind `LocalSemanticUnit` objects: one neutral retrieval sentence plus concrete B-rep/image facts. Rule ids and final judgements are added only after knowledge retrieval and detailed rule verification.
|
|
|
|
Assembly diagnosis scope:
|
|
|
|
- For `SLDASM` input, diagnose both assembly-level relations and part-level structure.
|
|
- Standard or purchased components are marked `review_scope=assembly_context_only`; they are used for mating context, accessibility, and standard-part selection/calculation checks, but not for nonstandard part-structure taboo checks.
|
|
- Nonstandard or self-designed components are marked `review_scope=part_design_required`; AI must generate local semantic units for their local shape, surfaces, holes/slots/bosses/ribs, machining accessibility, stiffness, and other part-design views.
|
|
|
|
For assembly input, the report also emits two alignment structures:
|
|
|
|
- `ComponentEvidencePackages`: one package per SolidWorks component instance. It partitions assembly-derived B-rep faces, feature ids, and contact ids by component so evidence from different parts is not mixed.
|
|
- `PartImagePlan`: image-export plan for components with `review_scope=part_design_required`. These images may come from the component part file, but their geometry facts must still use the component's B-rep subset extracted from the assembly. Do not re-extract part B-rep independently and merge it into the assembly report.
|
|
|
|
Diagnosis order for assemblies:
|
|
|
|
1. Analyze assembly-level design issues first: contacts, fits, locating, support, disassembly, accessibility, motion/interference, sealing, and lubrication.
|
|
2. Then analyze each nonstandard/self-designed component's part-design issues using its `ComponentEvidencePackage` plus the matching `PartImagePlan` images.
|
|
3. Standard or purchased components remain assembly context unless the specific rule is about standard-part selection or calculation.
|
|
|