FIX: Resolve all paths to absolute before passing to NX

Root cause: Path.absolute() on Windows does NOT resolve '..' components.
sim_file_path was reaching NX as '...\studies\01_doe_landscape\..\..\models\Beam_sim1.sim'
NX likely can't resolve referenced parts from a path with '..' in it.

Fixes:
- nx_interface.py: glob from self.model_dir (resolved) not model_dir (raw)
- solver.py: sim_file.resolve() instead of sim_file.absolute()
- solve_simulation.py: os.path.abspath(sim_file_path) at entry point
- Diagnostic logging still in place for next run
This commit is contained in:
2026-02-11 15:24:20 +00:00
parent 55f0f917c7
commit 80104d2467
19 changed files with 3445 additions and 8 deletions

View File

@@ -183,16 +183,18 @@ class AtomizerNXSolver:
logger.info("Using existing model backup at %s", self._backup_dir)
# Find the .sim file
sim_files = list(model_dir.glob("*.sim"))
# Use resolved model_dir for all path operations (NX needs clean absolute paths)
sim_files = list(self.model_dir.glob("*.sim"))
if not sim_files:
raise FileNotFoundError(f"No .sim file found in {model_dir}")
self.sim_file = sim_files[0]
raise FileNotFoundError(f"No .sim file found in {self.model_dir}")
self.sim_file = sim_files[0] # Already absolute (from resolved parent)
logger.info("SIM file: %s", self.sim_file.name)
logger.info("SIM path: %s", self.sim_file)
# Find the .prt file (for mass extraction)
prt_files = [f for f in model_dir.glob("*.prt") if "_i." not in f.name]
prt_files = [f for f in self.model_dir.glob("*.prt") if "_i." not in f.name]
if not prt_files:
raise FileNotFoundError(f"No .prt file found in {model_dir}")
raise FileNotFoundError(f"No .prt file found in {self.model_dir}")
self.prt_file = prt_files[0]
logger.info("PRT file: %s", self.prt_file.name)