- Replace scipy.spatial.Delaunay with Shewchuk's Triangle (PSLG-based) - Boundary conforming: PSLG constrains edges along inset contour + hole keepout rings - Quality: min angle 25°, no slivers - Per-triangle density-based area refinement (s_min=20, s_max=80) - Clean boundary plotting (no more crooked v1 line resampling) - Triangulation plot shows inset contour (red dashed) + keepout rings (orange dashed) - Add sandbox2_brain_input.json geometry file
51 lines
2.2 KiB
Python
51 lines
2.2 KiB
Python
"""
|
||
Atomizer/Optuna integration for adaptive isogrid optimization.
|
||
|
||
Wires: parameter sampling → Python Brain → NX Hands → result extraction.
|
||
"""
|
||
|
||
# Parameter space definition
|
||
PARAM_SPACE = {
|
||
# Density field
|
||
'eta_0': {'type': 'float', 'low': 0.0, 'high': 0.4, 'desc': 'Baseline density offset'},
|
||
'alpha': {'type': 'float', 'low': 0.3, 'high': 2.0, 'desc': 'Hole influence scale'},
|
||
'R_0': {'type': 'float', 'low': 10.0, 'high': 100.0, 'desc': 'Base influence radius (mm)'},
|
||
'kappa': {'type': 'float', 'low': 0.0, 'high': 3.0, 'desc': 'Weight-to-radius coupling'},
|
||
'p': {'type': 'float', 'low': 1.0, 'high': 4.0, 'desc': 'Decay exponent'},
|
||
'beta': {'type': 'float', 'low': 0.0, 'high': 1.0, 'desc': 'Edge influence scale'},
|
||
'R_edge': {'type': 'float', 'low': 5.0, 'high': 40.0, 'desc': 'Edge influence radius (mm)'},
|
||
# Spacing
|
||
's_min': {'type': 'float', 'low': 8.0, 'high': 20.0, 'desc': 'Min cell size (mm)'},
|
||
's_max': {'type': 'float', 'low': 25.0, 'high': 60.0, 'desc': 'Max cell size (mm)'},
|
||
# Rib thickness
|
||
't_min': {'type': 'float', 'low': 2.0, 'high': 4.0, 'desc': 'Min rib thickness (mm)'},
|
||
't_0': {'type': 'float', 'low': 2.0, 'high': 6.0, 'desc': 'Nominal rib thickness (mm)'},
|
||
'gamma': {'type': 'float', 'low': 0.0, 'high': 3.0, 'desc': 'Density-thickness coupling'},
|
||
# Manufacturing
|
||
'w_frame': {'type': 'float', 'low': 3.0, 'high': 20.0, 'desc': 'Perimeter frame width (mm)'},
|
||
'r_f': {'type': 'float', 'low': 3.0, 'high': 10.0, 'desc': 'Pocket fillet radius (mm)'},
|
||
'd_keep': {'type': 'float', 'low': 1.0, 'high': 3.0, 'desc': 'Hole keepout multiplier (× diameter)'},
|
||
'min_triangle_area': {'type': 'float', 'low': 5.0, 'high': 80.0, 'desc': 'Minimum pocketable triangle area (mm²)'},
|
||
}
|
||
|
||
# Default parameters for standalone brain testing
|
||
DEFAULT_PARAMS = {
|
||
'eta_0': 0.1,
|
||
'alpha': 1.0,
|
||
'R_0': 30.0,
|
||
'kappa': 1.0,
|
||
'p': 2.0,
|
||
'beta': 0.3,
|
||
'R_edge': 15.0,
|
||
's_min': 20.0,
|
||
's_max': 80.0,
|
||
't_min': 2.5,
|
||
't_0': 3.0,
|
||
'gamma': 1.0,
|
||
'w_frame': 8.0,
|
||
'r_f': 6.0,
|
||
'd_keep': 1.5,
|
||
'min_pocket_radius': 6.0,
|
||
'min_triangle_area': 20.0,
|
||
}
|