x

Version 3.25.1 (Released at 12/05/2021)
- Small typo in tutorial 06 text has been fixed.

HYRCAN:
Version 1.75.3 (Released at 12/01/2021)
- Bug in memory allocation of support element has been fixed.
- Minor changes in Italian translation.


Accessing variables in script(Read 116 times)
Accessing variables in script on: October 03, 2021, 09:50:15 pm
Hi,

I have been playing around with the scripting which i do find extremely useful.

A useful feature would be to be able to access the FOS as a variable after running a model (maybe this is already possible but it is not clear how it could be done).

I have tried using the return value of the compute() method however it appears to return nothing after it runs so i am not sure where the FOS is stored.

This could be useful in running a loop which checks the FOS after a computation and changes the model if the FOS is too low by adjusting the slope or any loading until the FOS becomes acceptable.

Thanks,
Jesse



Re: Accessing variables in script Reply #1 on: October 04, 2021, 09:11:48 am
Hi Jesse,

thanks for the comments. yes this is in the list. I'm currently working on couple of other subroutines when it's done, I will take a look at scripting functions.

-Roozbeh



Re: Accessing variables in script Reply #2 on: October 22, 2021, 03:57:23 pm
Hi Roozbeh,

I understand you are busy with other items at the moment but when you come back around to this item i think the way to achieve it would be as follows.

Within the QT script add the following line that should run at the end of 'compute()':

engine.globalObject().setProperty('fos',*FOS_VARIABLE*)

where FOS_VARIABLE is the slope factor of safety determined after computation

See below:
https://doc.qt.io/qt-5/qtscript-index.html#making-a-qobject-available-to-the-script-engine

Thanks,
Jesse



Re: Accessing variables in script Reply #3 on: October 24, 2021, 02:03:27 pm
thanks, it's going to be done differently in the HYRCAN but same concept.



Re: Accessing variables in script Reply #4 on: November 03, 2021, 05:02:34 pm
In the new version (i.e. V1.75.1), you will be able to extract some information. Please take a look at uploaded script:

http://geowizard.org/forum/index.php?topic=356.msg1128#msg1128

also look at page "Set/Get Information" under "Scripting Language" in the help menu.