I think I am doing something basic wrong. I have a smash file with multiple simulations and want to run things in python to avoid error.
-- coding: utf-8 --
import s4l_v1.document as document
import XSimulator as simulator
import s4l_v1.simulation as simulation
file= 'C:\Users\will\Documents\EMS2N2_EFieldSims\RedoneSims\XYZBodyModels\XYZBodyModels.smash'
#document.Open(file)
print('Hello strange world')
nsims = simulator.NumberOfSimulations()
print 'Running ', nsims,' simulations'
sims = list(document.AllSimulations)
for n in range(nsims):
sim = simulator.GetSimulation(n)
test = sim.HasResults(1)
if test == 1:
print 'Doing analysis'
#Get the results
res = sim.Results()
The list of simulations does nothing, and the last statement returns an error. Though the examples I found on the forum indicate it should return an extractor, that I could use to do things with....
Hello strange world
Running 32 simulations
Doing analysis
Traceback (most recent call last):
File "C:\Users\will\Documents\EMS2N2_EFieldSims\RedoneSims\XYZBodyModels\batchRunBabyCenter.py", line 25, in <module>
res = sim.Results()
AttributeError: 'XObject' object has no attribute or child object named 'Results'
If I understand the API browser then the simulation should be an ElectroQuasiStaticSimulation object, and the Results() method should give me an extractor, with the field sensor data in it......
Any help appreciated.
Will