Hello everybody,
When trying to convert one of my SEMCAD X 14.8 scripts which loops though the certain directory at the hard-drive, opens all simulations, check if simulation has a EM results and if not add it to the simulation *.batch file (code bellow)
import SEMCAD
import os
import time
import PostPro
import numpy, scipy
import math
import XNumPy
clear_console()
os.chdir(sys.path[0])
test_dir = os.getcwd() # Directory to check - current directory where script is located
### List of all simulation files (*.sem) in directory
sem_files = []
mat_files = []
add_string = ''
for root, dirs, files in os.walk(test_dir):
if len(files)>0:
for ff in files:
if '.sem' in ff and add_string in ff:
sem_files.append(root+'\\'+ff)
for sem in sem_files:
SEMCAD.OpenProject(sem)
SEMCAD.SetSimulationMode()
for sim in SEMCAD.simulations.List:
if not sim.HasResults():
if not sim.HasVoxels():
sim.ComputeVoxels()
sim.PrepareForRemoteSolver()
file_name = 'c:\\Sim_Batch.bat'
project_path_name = SEMCAD.GetProjectPath()
if os.path.isfile(file_name):
file = open(file_name,"a")
file.write("\""+SEMCAD.Preferences.Solver+"\" "+"\t"+" \""+sim.GetSolverInputFilePath()+"\"\n")
file.close()
else:
file = open(file_name,"w")
file.write("REM This file was automatically generated\n")
file.write("REM by the BatchFile Function of SEMCAD X.\n")
file.write("REM \n\n")
file.write("\""+SEMCAD.Preferences.Solver+"\" "+"\t"+" \""+sim.GetSolverInputFilePath()+"\"\n")
file.close()
I struggle in Sim4Life in getting the list of input files *.h5 files from multi-port simulation. Would somebody knows how to do that?
Thanks,
Spuky