Delete Simulation and Results
-
wrote on 16 Apr 2021, 10:44 last edited by
Hi,
Does anyone know how to delete a simulation and its results using the Python API?
Thanks!
-
wrote on 17 Apr 2021, 02:13 last edited by
Why use Python api
-
@lj said in Delete Simulation and Results:
Hi,
Does anyone know how to delete a simulation and its results using the Python API?
Thanks!
Hi Lj,
the commands below should help:
import s4l_v1.document as document sim = document.AllSimulations[0] # access by index, starting with 0 #sim = document.AllSimulations["my_simulation"] # access by name
sim.ClearResults() # delete results
sim.ResetVoxels() # delete voxels
document.AllSimulations.Remove(sim) # remove simulation from project
-
@lj said in Delete Simulation and Results:
Thank you @Sylvain!
you're welcome!
I would also recommend using the auto-completion feature in the Console. For example, if you type
sim=document.AllSimulations[0]
to assign the
sim
variable and thensim
followed by a.
(dot) , you should see all the functions that you can use with this simulation object. Usually easier than trying to remember all of them :) -
wrote on 19 Apr 2021, 08:33 last edited by
Yeah, I do use it. Its very helpful! I guess the mistake I was making was trying to find the delete/ remove within sim rather than document.allsimulations.
-
wrote on 19 Apr 2021, 08:37 last edited by
That makes sense- thank you!
-
wrote on 11 Aug 2022, 05:31 last edited by
sim.ClearResults() # delete results
sim.ResetVoxels() # delete voxels
document.AllSimulations.Remove(sim) # remove simulation from projectafter adding this lines i got this error :
Analysis : [Warn] Results Were Deleted
Analysis : [Warn] Results are not ready and simulation could not be located
Analysis : [Error] sim 2: Failed to compute output attributes
Analysis : [Warn] Results are not ready and simulation could not be located
Analysis : [Error] sim 2: Failed to compute output attributes
Analysis : [Error] Overall Field: Could not update input attributes
Analysis : [Warn] Results are not ready and simulation could not be located
Analysis : [Error] sim 2: Failed to compute output attributes
Analysis : [Error] Overall Field: Could not update input attributes
Analysis : [Error] EM E(x,y,z,f0) - Slice Viewer: Could not update input attributes
Analysis : [Warn] Results are not ready and simulation could not be located
Analysis : [Error] sim 2: Failed to compute output attributes
Analysis : [Error] Overall Field: Could not update input attributes
Analysis : [Error] EM Potential(x,y,z,f0) - Slice Viewer: Could not update input attributes
Analysis : [Warn] Results are not ready and simulation could not be located
Analysis : [Error] sim 2: Failed to compute output attributes
Analysis : [Error] Overall Field: Could not update input attributes
Analysis : [Error] EM E(x,y,z,f0) - Streamline Viewer: Could not update input attributes -
wrote on 11 Aug 2022, 10:19 last edited by
also h5 output files disappear !
-
wrote on 11 Aug 2022, 10:21 last edited by
can you provide a bit more detail about what you're trying to do?
-
wrote on 11 Aug 2022, 11:37 last edited by
i load several meshes one of them is moving and also each time it transmit other frequency, so for each state i need different simulation (sweep not good for me)
-
wrote on 11 Aug 2022, 12:07 last edited by LJ 8 Nov 2022, 12:08
Hmm I am not sure I understand. Is it possible to share more of your code and explain exactly what is not working?
I use the lines of code you posted regularly and it works just fine.