x

ADONIS:
Version 3.90.4 (Released at 04/07/2024)
- Bug in interface save/read is fixed.
- Bug in mesh generation action has been fixed.

HYRCAN:
Version 2.0.13 (Released at 02/03/2024)
- To allow users to import CAD files using scripting, the importmodel command is introduced.
- Program's webhelp has been reformatted.


Importing(Read 7716 times)
Importing on: June 26, 2018, 09:48:59 am
Hello,
I work on a script for reinforced embankments and wonder if there is a possibility to import some external libraries, for example some popup window for user input (embankmnent's height, soil layers, etc.). I would like parametrize the model to the point that user doesn't have to edit .ajs file. I would like also ommit generating .ajs externally from excel (like somebody on this forum did, wow) or from python. I couldn't even handle importing .txt file with fileID=fopen("input.txt","r"). Is any of those features available? Do you have some examples?



Re: Importing Reply #1 on: June 26, 2018, 10:02:54 am
unfortunately the pop up dialog feature is not available in current version. user can only modify the script and perform rerun. I personally am using third party programs to generate scripts for instance matlab or octave (free version similar to matlab). excel has been used also as you mentioned. it's really up to user.

basically you can use any program to generate *.ajs file including python. for example in python code ask users for the input(s) in whatever way you want then after processing the data generate script and spit out the ajs file to be loaded in ADONIS.

fopen("input.txt","r") command is only designed to read/write data that wanted to be used inside ADONIS not for loading the script. in case you want to import some numbers and use them during the run you would use this command.

I hope I answered all your questions.

-Roozbeh



Re: Importing Reply #2 on: June 26, 2018, 11:19:13 am
Ok, thank you for your reply. So I reconsider generating my script in Python. When it's done Im going to share it on the forum.
Accoding to fopen("input.txt","r"): can I read txt file like this?:

input.txt:
"layer1", 30, 10, 20, "silt"
"layer2", 38, 0, 19, "sand"
"layer3", 5, , 20, "clay"

to be a list:
[["layer1", 30, 10, 20, "silt"], ["layer2", 38, 0, 19, "sand"], ["layer3", 5, , 20, "clay"]]

Could you tell me how to properly write this part of script, as I had big problem with it?




Re: Importing Reply #3 on: June 26, 2018, 11:51:36 am
why don't you put this directly inside the *.ajs file instead of "input.txt"? honestly I don't see any reason to separate these data.



Re: Importing Reply #4 on: June 26, 2018, 02:49:51 pm
My first idea was to separate input data file .txt and model file .ajs. Then yes, I found it pointless too:) Now it's only a pure curiosity how the read-from-file function works. Don't bother if it needs some time to explain.



Re: Importing Reply #5 on: June 26, 2018, 07:38:56 pm
thanks for your comment, I was forced to go back to the code I developed for IO File long time ago and realized that I didn't create any code for read function unfortunately. so perhaps I have to do it in the near future. for now the fopen("filename","r") is practically useless until I include the necessary functions. you can only write into the file. thanks again.
« Last Edit: June 26, 2018, 07:52:36 pm by Roozbeh »