Files
Atomizer/optimization_engine/import_expressions.py
Anto01 b4c0831230 fix: Remove redundant save() call that overwrote NX expression updates
Critical bug fix for LLM mode optimization:

**Problem**:
- NXParameterUpdater.update_expressions() uses NX journal to import expressions (default use_nx_import=True)
- The NX journal directly updates the PRT file on disk and saves it
- But then run_optimization.py was calling updater.save() afterwards
- save() writes self.content (loaded at initialization) back to file
- This overwrote the NX journal changes with stale binary content!

**Result**: All optimization trials produced identical FEM results because the model was never actually updated.

**Fixes**:
1. Removed updater.save() call from model_updater closure in run_optimization.py
2. Added theSession.Parts.CloseAll() in import_expressions.py to ensure changes are flushed and file is released
3. Fixed test_phase_3_2_e2e.py variable name (best_trial_file → results_file)

**Testing**: Verified expressions persist to disk correctly with standalone test.

Next step: Address remaining issue where FEM results are still identical (likely solve journal not reloading updated PRT).
2025-11-17 21:24:02 -05:00

2.5 KiB