mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 19:09:07 +00:00
4a6087699b
The MEP bend feature's IfcSweptDiskSolid representation produces geometrically correct output but fails to round-trip through the OpenCascade geometry kernel (upstream issue #8106) — the body is dropped on the next file load. Until upstream is fixed, MEPAddBend captures the bend centerline in world space before the segments are extended (otherwise the post-extension axes no longer reach the original intersection and arc reconstruction is wrong), then after the fitting is placed it hand-meshes the bend body and swaps the type's swept-disk representation for an IfcTessellatedFaceSet via tool.Geometry.export_mesh_to_tessellation + tool.Model. replace_object_ifc_representation. The centerline includes the straight start_length / end_length legs in addition to the arc so the bend covers the full segment-to- segment span. Sweep uses parallel-transport framing — each ring's (right, up) basis is rotated by the minimum rotation that maps the previous tangent to the current one, eliminating the twist a fixed world-axis reference produces when the tangent crosses the reference. Cross-section orientation seeds from the source segment's matrix_world local +X / +Y so asymmetric IfcRectangleProfileDef ducts land with XDim / YDim on the same axes the segment expects; parallel transport then preserves that alignment around the arc. Centerline radius is radius + profile_dim[lateral_axis] to match MEPAddBend's ref_point_radius — without this offset, the bend legs fall short of the extended segments by profile_dim * tan(angle/2). Face winding is left to the caller to correct via bmesh.ops.recalc_face_normals on the closed bend tube. Two FIXME(#8106) markers (capture site + helper call site) so both can be dropped once upstream lands a swept-disk round-trip fix. Generated with the assistance of an AI coding tool.