80 lines
2.3 KiB
Markdown
80 lines
2.3 KiB
Markdown
# DimensionFaceMatcher
|
|
|
|
`DimensionFaceMatcher` is a prototype matcher for linking 2D drawing dimensions to 3D B-rep face pairs.
|
|
|
|
It does not require SolidWorks or AutoCAD at runtime. It consumes:
|
|
|
|
- `section_brep_report.json` from `tools/model-diagnostics/SectionBrepExtractor`
|
|
- a normalized 2D dimension anchor JSON file
|
|
|
|
The matcher projects each 3D face center and BBox into the selected drawing view, normalizes both 2D and projected 3D coordinates by their overall bounds, and ranks face pairs by:
|
|
|
|
- dimension value match
|
|
- projected position match for the two dimension anchors
|
|
- projected BBox similarity
|
|
- owner component hints
|
|
- face type and coarse relation semantics
|
|
|
|
## Run
|
|
|
|
```powershell
|
|
dotnet run --project tools\drawing-diagnostics\DimensionFaceMatcher\DimensionFaceMatcher.csproj -- `
|
|
--brep-report tools\drawing-diagnostics\DimensionFaceMatcher\examples\minimal_brep_report.json `
|
|
--dimensions tools\drawing-diagnostics\DimensionFaceMatcher\examples\minimal_dimensions.json `
|
|
--view-direction +Z `
|
|
--roll 0 `
|
|
--output-dir runtime\dimension-face-matcher-smoke
|
|
```
|
|
|
|
Output:
|
|
|
|
```text
|
|
runtime\dimension-face-matcher-smoke\dimension_face_matches.json
|
|
```
|
|
|
|
## Dimension Input
|
|
|
|
```json
|
|
{
|
|
"view": {
|
|
"direction": "+X",
|
|
"rollDeg": 270,
|
|
"drawingBBox": { "minX": 0, "minY": 0, "maxX": 300, "maxY": 200 }
|
|
},
|
|
"dimensions": [
|
|
{
|
|
"id": "dim_001",
|
|
"text": "Phi30 H7/h6",
|
|
"measurementMm": 30,
|
|
"kind": "cylindrical_fit",
|
|
"ownerComponents": ["shaft", "bearing"],
|
|
"anchors": [
|
|
{ "id": "a", "bbox": { "minX": 10, "minY": 20, "maxX": 10, "maxY": 60 } },
|
|
{ "id": "b", "bbox": { "minX": 45, "minY": 20, "maxX": 45, "maxY": 60 } }
|
|
]
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
Supported `kind` values:
|
|
|
|
- `cylindrical_fit`
|
|
- `diameter`
|
|
- `plane_distance`
|
|
- `linear_distance`
|
|
- `axis_distance`
|
|
|
|
If `kind` is missing, the matcher infers a coarse type from the dimension text.
|
|
|
|
## Notes
|
|
|
|
This first version intentionally uses approximate projection:
|
|
|
|
- face center projection
|
|
- face BBox corner projection
|
|
- cylinder diameter/radius and axis metadata
|
|
- plane normal and center distance
|
|
|
|
It does not compute exact visible outlines, hidden-line occlusion, or tangent/silhouette curves. Those should be added later through SolidWorks drawing-view entity references if higher confidence is needed.
|