LUA Scripting with FEKO

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

hi. i am currently able to load a cfx file with lua script as follows:

 app = cf.GetApplication() project = app:OpenFile('doit.cfx')

How can change or see variables inside this file?

Thanks...

Tagged:

Answers

  • JIF
    JIF
    Altair Employee
    edited November 2017

    Hello mustaphos,

     

    At this point you need to have a look at the CADFEKO API. Everything you need will be under 'project'. I would suggest that you have a look at chapter 7.1 (Scripting basics) and in particular the example in 7.1.1. I would then suggest that you work through example I-1 in the Example guide since it walks you through the process of creating a model in CADFEKO. Reading settings from the model is the same and it is also demonstrated.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2017

    Hello @mustaphos,

     

    @JIF beat me to it...! ;)/emoticons/default_wink.png' srcset='/emoticons/wink@2x.png 2x' title=';)' width='20' />  Of course, this is the 'more correct' way to learn how to do scripting and automation.

     

    The shortcut way to get started with scripting (in CADFEKO) is to use 'Macro recording'.  You'll see in the status bar (in the bottom of the application) a button with a puzzle piece and a red circle.  If you press this, then CADFEKO will record every action you take that changes the model.  In other words, if you start recording and create / modify / delete a variable, then a script will be recorded that shows you how to do precisely that one bit of scripting. 

     

    It's cheating but I won't tell anyone.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2017

    Hello @mustaphos,

     

    @JIF beat me to it...! ;)/emoticons/default_wink.png' srcset='/emoticons/wink@2x.png 2x' title=';)' width='20' />  Of course, this is the 'more correct' way to learn how to do scripting and automation.

     

    The shortcut way to get started with scripting (in CADFEKO) is to use 'Macro recording'.  You'll see in the status bar (in the bottom of the application) a button with a puzzle piece and a red circle.  If you press this, then CADFEKO will record every action you take that changes the model.  In other words, if you start recording and create / modify / delete a variable, then a script will be recorded that shows you how to do precisely that one bit of scripting. 

     

    It's cheating but I won't tell anyone.

    Wow it's very nice.

    Thanks you sir.

    I immediately found the variables i wanted.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2017

    Great! I'm glad it helps.  It's definitely worth it to go through the Examples Guide example, though.  It takes you through the basic concepts and shows you how to navigate the API documentation.