fix: NX installation path detection for run-baseline endpoint
- Read nx_install_path from atomizer_spec.json if available - Auto-detect from common Siemens installation paths - Fixes issue where NX2512 wasn't found (actual path is DesigncenterNX2512)
This commit is contained in:
@@ -4662,8 +4662,31 @@ async def run_baseline_simulation(study_id: str):
|
|||||||
# Try to run the solver
|
# Try to run the solver
|
||||||
try:
|
try:
|
||||||
from optimization_engine.nx.solver import NXSolver
|
from optimization_engine.nx.solver import NXSolver
|
||||||
|
from pathlib import Path as P
|
||||||
|
|
||||||
|
# Try to get NX settings from spec
|
||||||
|
spec_file = study_dir / "atomizer_spec.json"
|
||||||
|
nx_install_path = None
|
||||||
|
if spec_file.exists():
|
||||||
|
with open(spec_file) as f:
|
||||||
|
spec_data = json.load(f)
|
||||||
|
nx_install_path = (
|
||||||
|
spec_data.get("model", {}).get("nx_settings", {}).get("nx_install_path")
|
||||||
|
)
|
||||||
|
|
||||||
|
# Default to common installation path if not in spec
|
||||||
|
if not nx_install_path:
|
||||||
|
for candidate in [
|
||||||
|
"C:/Program Files/Siemens/DesigncenterNX2512",
|
||||||
|
"C:/Program Files/Siemens/NX2506",
|
||||||
|
"C:/Program Files/Siemens/NX2412",
|
||||||
|
]:
|
||||||
|
if P(candidate).exists():
|
||||||
|
nx_install_path = candidate
|
||||||
|
break
|
||||||
|
|
||||||
solver = NXSolver(
|
solver = NXSolver(
|
||||||
|
nx_install_dir=P(nx_install_path) if nx_install_path else None,
|
||||||
nastran_version="2512",
|
nastran_version="2512",
|
||||||
timeout=600,
|
timeout=600,
|
||||||
use_journal=True,
|
use_journal=True,
|
||||||
|
|||||||
Reference in New Issue
Block a user