diff --git a/tools/adaptive-isogrid/src/brain/profile_assembly.py b/tools/adaptive-isogrid/src/brain/profile_assembly.py index f3de64da..292c94c5 100644 --- a/tools/adaptive-isogrid/src/brain/profile_assembly.py +++ b/tools/adaptive-isogrid/src/brain/profile_assembly.py @@ -88,13 +88,26 @@ def profile_to_json(ribbed_plate, pockets, geometry, params): else: outer = [list(p) for p in outer] - # Structured pocket data (lines + arcs) + # Structured pocket data (lines + arcs) — only include pockets fully inside boundary + plate = Polygon(outer) pocket_data = [] + skipped = 0 for p in pockets: + # Use polyline to check containment + polyline = p.get('polyline', []) + if polyline: + pocket_poly = Polygon(polyline) + if pocket_poly.is_valid and not pocket_poly.is_empty: + if not plate.contains(pocket_poly): + skipped += 1 + continue pocket_data.append({ 'lines': p['lines'], 'arcs': p['arcs'], }) + if skipped > 0: + import sys + print(f"[profile_assembly] Skipped {skipped} pockets outside boundary", file=sys.stderr) # Hole data for NX (circles) hole_data = [] diff --git a/tools/adaptive-isogrid/test_data/rib_profile_sandbox_1.json b/tools/adaptive-isogrid/test_data/rib_profile_sandbox_1.json index 80bc9a8a..c1dfc592 100644 --- a/tools/adaptive-isogrid/test_data/rib_profile_sandbox_1.json +++ b/tools/adaptive-isogrid/test_data/rib_profile_sandbox_1.json @@ -4821,93 +4821,6 @@ } ] }, - { - "lines": [ - [ - [ - 137.46390326476583, - -6.926432436063079 - ], - [ - 131.05370092972248, - -15.73755838552485 - ] - ], - [ - [ - 132.8437974875087, - -24.427347047759888 - ], - [ - 144.4719176935919, - -31.327076990816487 - ] - ], - [ - [ - 153.2278507027968, - -24.275921959753173 - ], - [ - 148.00993283175694, - -8.565066067234806 - ] - ] - ], - "arcs": [ - { - "tangent_start": [ - 148.00993283175694, - -8.565066067234806 - ], - "tangent_end": [ - 137.46390326476583, - -6.926432436063079 - ], - "center": [ - 142.3157668424484, - -10.456222773116707 - ], - "radius": 6.0, - "start_angle": 0.320659785970062, - "end_angle": 2.5126397041359354 - }, - { - "tangent_start": [ - 131.05370092972248, - -15.73755838552485 - ], - "tangent_end": [ - 132.8437974875087, - -24.427347047759888 - ], - "center": [ - 135.90556450740507, - -19.26734872257848 - ], - "radius": 6.0, - "start_angle": 2.5126397041359376, - "end_angle": -2.1063235281199986 - }, - { - "tangent_start": [ - 144.4719176935919, - -31.327076990816487 - ], - "tangent_end": [ - 153.2278507027968, - -24.275921959753173 - ], - "center": [ - 147.53368471348827, - -26.167078665635074 - ], - "radius": 6.0, - "start_angle": -2.106323528119998, - "end_angle": 0.3206597859700635 - } - ] - }, { "lines": [ [