Add rib_web to Brain output + import_profile draws rib material

Brain: profile_assembly.py now exports 'rib_web' — the actual material
geometry from Shapely boolean (exterior + interior rings). This is the
rib shape, not the pocket cutouts.

import_profile.py: prefers rib_web when available, drawing exterior +
interior polyline rings directly. Falls back to pocket-based drawing
for older rib JSONs without rib_web.
This commit is contained in:
2026-02-17 03:02:15 +00:00
parent 0bc0c24c1c
commit 1badc370ab
4 changed files with 10640 additions and 66 deletions

View File

@@ -106,10 +106,28 @@ def profile_to_json(ribbed_plate, pockets, geometry, params):
'is_circular': True,
})
# Rib web profile: the actual material geometry from Shapely boolean
# This is what NX needs to draw — the ribs, not the pockets.
rib_web_rings = []
if ribbed_plate.geom_type == 'Polygon':
polys = [ribbed_plate]
elif ribbed_plate.geom_type == 'MultiPolygon':
polys = list(ribbed_plate.geoms)
else:
polys = []
for poly in polys:
ring = {
'exterior': [list(c) for c in poly.exterior.coords],
'interiors': [[list(c) for c in interior.coords] for interior in poly.interiors],
}
rib_web_rings.append(ring)
return {
'valid': True,
'outer_boundary': outer,
'pockets': pocket_data,
'holes': hole_data,
'rib_web': rib_web_rings,
'parameters_used': params,
}