feat: add adaptive isogrid tool — project foundations
- Python Brain: density field, constrained Delaunay triangulation, pocket profiles, profile assembly, validation modules - NX Hands: skeleton scripts for geometry extraction, AFEM setup, per-iteration solve (require NX environment to develop) - Atomizer integration: 15-param space definition, objective function - Technical spec, README, sample test geometry, requirements.txt - Architecture: Python Brain + NX Hands + Atomizer Manager
This commit is contained in:
54
tools/adaptive-isogrid/src/nx/extract_geometry.py
Normal file
54
tools/adaptive-isogrid/src/nx/extract_geometry.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
NXOpen script — Extract plate geometry from selected face.
|
||||
|
||||
ONE-TIME: Run inside NX. User selects plate face, assigns hole weights.
|
||||
Exports geometry.json for the Python brain.
|
||||
|
||||
NOTE: This is pseudocode / skeleton. Actual NXOpen API calls need
|
||||
NX environment to develop and test.
|
||||
"""
|
||||
|
||||
# This script runs inside NX — NXOpen is available at runtime
|
||||
# import NXOpen
|
||||
# import json
|
||||
# import math
|
||||
|
||||
|
||||
def extract_plate_geometry(face, hole_weights):
|
||||
"""
|
||||
Extract plate geometry from an NX face.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
face : NXOpen.Face
|
||||
The selected plate face.
|
||||
hole_weights : dict
|
||||
{loop_index: weight} from user input.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict : geometry definition for export.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"This script must be developed and tested inside NX Simcenter. "
|
||||
"See docs/technical-spec.md Section 2 for full pseudocode."
|
||||
)
|
||||
|
||||
|
||||
def sample_edge(edge, tolerance=0.1):
|
||||
"""Sample edge curve as polyline with given chord tolerance."""
|
||||
# NXOpen: edge.GetCurve(), evaluate at intervals
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def fit_circle(points):
|
||||
"""Fit a circle to boundary points. Returns (center, diameter)."""
|
||||
# Least-squares circle fit
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def export_geometry(geometry, filepath='geometry.json'):
|
||||
"""Export geometry dict to JSON."""
|
||||
import json
|
||||
with open(filepath, 'w') as f:
|
||||
json.dump(geometry, f, indent=2)
|
||||
Reference in New Issue
Block a user