In the following example, a math script is created within the lua script:
app = pf.GetApplication() app:NewProject() app:OpenFile(FEKO_HOME..[[/shared/Resources/Automation/startup.fek]]) -- Create a math script farFieldMathScript = app.MathScripts:Add(pf.Enums.MathScriptTypeEnum.FarField) script = [[ dataSet = pf.FarField.GetDataSet("startup.StandardConfiguration1.FarFields", 51) scale = 2 for freqIndex = 1, #dataSet.Axes["Frequency"] do for thetaIndex = 1, #dataSet.Axes["Theta"] do for phiIndex = 1, #dataSet.Axes["Phi"] do indexedValue = dataSet[freqIndex][thetaIndex][phiIndex] indexedValue.EFieldTheta = indexedValue.EFieldTheta * scale indexedValue.EFieldPhi = indexedValue.EFieldPhi * scale end end end return dataSet ]] farFieldMathScript.Script = script -- Run the math script farFieldMathScript:Run() -- Plot the math script farFieldPlot = app.Views[1].Plots:Add(farFieldMathScript)
Could I use a variable of the main script and introduce it into the math script?
I would like to create "dynamic" math scripts.
If so, what's the syntax?
Thanks