fix(render): fix double-transform bug in USD mesh extraction causing wrong part positions

In _extract_mesh(), BRep_Tool.Triangulation_s(face, face_loc) returns a face_loc
that already encodes the instance's full placement transform when a compound shape
is tessellated with BRepMesh_IncrementalMesh. Applying shape_trsf on top doubled
every rotation/translation, causing multiple roller elements to collapse to the same
wrong world position (e.g. Z(-75°)×2 ≡ Z(+105°)×2 mod 360° → identical positions).

Fix: use elif so shape_loc is only applied as a fallback when face_loc is identity.
Adds seam edge extraction (UV seam primvar) and improves _traverse_xcaf doc.

docs: learning erfasst - OCC face_loc double-transform in compound tessellation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 16:43:33 +01:00
parent 71e099305c
commit de7f97be87
2 changed files with 89 additions and 7 deletions
+5
View File
@@ -437,6 +437,11 @@ for obj in mesh_objects:
**Lösung:** `GCPnts_UniformAbscissa(curve3d, step_mm=0.3, tol=1e-6)` auf der analytischen B-rep-Kurve (`BRepAdaptor_Curve`) samplen. 0.3mm-Schritt garantiert dass konsekutive Sample-Paare die Tessellations-Kanten (~0.78-1.55mm) straddeln — die KD-Tree-Suche (TOL=0.5mm) findet dann die richtigen Blender-Mesh-Edges. Ergebnis: 17.129 Segment-Paare, 1.364 Kanten in Blender markiert.
**Imports:** `from OCP.GCPnts import GCPnts_UniformAbscissa; from OCP.BRepAdaptor import BRepAdaptor_Curve`
### 2026-03-12 | OCC/USD | export_step_to_usd.py: face_loc == shape_loc → Doppel-Transform → falsche Mesh-Positionen
`BRepMesh_IncrementalMesh` auf dem Root-Compound tesselliert alle Instanzen. `BRep_Tool.Triangulation_s(face, face_loc)` liefert dabei einen `face_loc`, der exakt die Instance-Platzierung des shape kodiert (identisch zu `shape.Location()`). In `_extract_mesh()` wurden beide Transforms nacheinander angewendet: erst `face_loc.Transformation()`, dann `shape_trsf` — was eine Doppel-Rotation ergibt. Für einen Zylinder-Rollensatz (12 Rollen à 30° Abstand) führt das dazu, dass mehrere Rollen auf dieselbe falsche Position kollabieren (z.B. -75° × 2 = -150° = +105° × 2 mod 360° → Rollen 3 und 9 landen identisch).
**Lösung:** `if face_has_loc: ... elif shape_has_loc: ...` statt `if face_has_loc: ... if shape_has_loc: ...`. `shape_loc` ist nur ein Fallback für direkt tessellierte Shapes (nicht als Teil eines Compounds), bei denen `face_loc` identity ist.
**Beweis:** Mit `face_only`-Extraktion (nur face_loc, kein shape_loc) erscheinen alle 10 Rollen bei genau 223,9mm Radius, gleichmäßig 30° verteilt.
---
## Offene Fragen