CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ANSA (https://www.cfd-online.com/Forums/ansa/)
-   -   Ansa Python Scripting (https://www.cfd-online.com/Forums/ansa/192133-ansa-python-scripting.html)

Renu123 August 29, 2017 05:54

Ansa Python Scripting
 
I want to read all my ansa file and want to load it one by one in ansa window. How I do that using python script?My code
import ansa
from ansa import *
def main():
m = utils.SelectOpenFileIn('/home/user/', 1) #for selecting multiple files
for i in range(len(m)):
print(m[i])


Using above code I am able to select all my file but I want to load it to ansa window one by one. I am looking for specific function of loading which able to do that.
Thank you.

maddoxx September 16, 2017 12:45

open ANSA files one by one
 
Hi,
Please use code wrap(# Button) from now on otherwise it will be difficult to understand the code. HTML does not provide TABS option

Code:

def main():
        selected_files = utils.SelectOpenFileIn('/home/user/', 1) #for selecting multiple files
        for each_file in selected_files:
                print("Each File :",each_file)
                ansa.base.Open(each_file) # for opening the file



All times are GMT -4. The time now is 15:05.