Hi, is there a way to read the current open *.sav file via the itasca python module?
I see only file.name() fish function in the manual so far.
Thanks,
Julia
i do not know if i understood your question properly, but here is how i restore sav files using python:
import os
import itasca as it
it.command(‘python-reset-state false’)
save_file = ‘filename’
it.fish.set(‘save_name’,save_file)
it.command(“model rest @save_name”)
@msepu thanks. sorry for not posting clear.
I have a sav file open. I open a python script and want to read the name of the open sav file automatically. something like
it.fish.get(filename)
which I then use in the labeling of an output plot produced in python.
You could also include opening the save file within your python script. This way you have the filename available in python, since you already used it (e.g. as a function argument) to restore the save-file.
what i found in the documentation is something you must set in your sav when creating it, and that is the project title. please see:
I would completely agree with this solution: set up a Python variable filename="path/to/sav"
then execute the Python command it.command(f'model restore {filename}')
.
Note that any Python data will be lost once the sav file is resotred. If you want to keep your Python state active, just execute the following FLAC3D command python-reset-state false
.
Thank you every one for the good suggestions.