feat: Add automatic solution monitor disabling for multi-solution workflows

Problem:
When running optimization studies with multiple solutions (e.g., static + modal),
NX opens solution monitor windows for each trial. These windows superpose and cause
usability issues during long optimization runs.

Solution:
- Automatically disable solution monitor when solving all solutions (solution_name=None)
- Loop through all solutions and set "solution monitor" property to False
- Implemented in solve_simulation.py before solve execution (lines 271-295)
- Includes error handling with graceful fallback

Benefits:
- No monitor window pile-up during optimization studies
- Better performance (no GUI overhead)
- No user configuration required - works automatically
- Based on user-recorded journal (journal_monitor_window_off.py)

Documentation:
- Updated docs/NX_MULTI_SOLUTION_PROTOCOL.md with solution monitor control section
- Added implementation details and when the feature activates
- Cross-referenced user's recorded journal

Implementation: optimization_engine/solve_simulation.py
Documentation: docs/NX_MULTI_SOLUTION_PROTOCOL.md
Reference: nx_journals/user_generated_journals/journal_monitor_window_off.py
This commit is contained in:
2025-11-24 10:36:10 -05:00
parent 7837255ba8
commit 74a92803b7
2 changed files with 80 additions and 0 deletions

View File

@@ -268,6 +268,32 @@ def main(args):
# Get the simulation object
simSimulation1 = workSimPart.FindObject("Simulation")
# CRITICAL: Disable solution monitor when solving multiple solutions
# This prevents NX from opening multiple monitor windows which superpose and cause usability issues
if not solution_name:
print("[JOURNAL] Disabling solution monitor for all solutions to prevent window pile-up...")
try:
# Get all solutions in the simulation
solutions_disabled = 0
solution_num = 1
while True:
try:
solution_obj_name = f"Solution[Solution {solution_num}]"
simSolution = simSimulation1.FindObject(solution_obj_name)
if simSolution:
propertyTable = simSolution.SolverOptionsPropertyTable
propertyTable.SetBooleanPropertyValue("solution monitor", False)
solutions_disabled += 1
solution_num += 1
else:
break
except:
break # No more solutions
print(f"[JOURNAL] Solution monitor disabled for {solutions_disabled} solution(s)")
except Exception as e:
print(f"[JOURNAL] WARNING: Could not disable solution monitor: {e}")
print(f"[JOURNAL] Continuing with solve anyway...")
# Get the solution(s) to solve - either specific or all
if solution_name:
# Solve specific solution in background mode