🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Need to add near-field script to existing POSTFEKO session using Lua

User: "John Underwood"
Altair Community Member
Updated by John Underwood

I am trying to add near-field scripts in POSTFEKO using Lua to dynamically generate them.

According to the API reference, I need to do the following:

nearFieldMathScript = app.MathScripts:Add(pf.Enums.MathScriptTypeEnum.NearField)

My problem is with "app".

When I try to use "app = pf.GetApplication()" to define the variable, I get the following error:

".. attempt to index global 'app' (a nil value)"

Any ideas?

Thanks in advance

Find more posts tagged with

Sort by:
1 - 4 of 41
    User: "Torben Voigt"
    Altair Employee
    Updated by Torben Voigt

    Hi @John Underwood ,

    What exactly is the goal of the script? Creating near field requests would only be possible in CADFEKO. Are you sure you mean POSTFEKO?

    Best regards,
    Torben Voigt

    User: "John Underwood"
    Altair Community Member
    OP
    Updated by John Underwood

    I need to process existing displayed near-field data with math scripts and would like to create these math scripts with a single custom script since there are many of them.

    Correct me if I am wrong but I think the fact that "app = pf.GetApplication()" does not work when in POSTFEKO is a major issue. I have tried the script examples in the guide and none of them work because of this.

    Your help is appreciated in this matter.

    Thanks

    User: "Torben Voigt"
    Altair Employee
    Updated by Torben Voigt

    I just tested just these 2 lines in POSTFEKO:

    app = pf.GetApplication()
    nearFieldMathScript = app.MathScripts:Add(pf.Enums.MathScriptTypeEnum.NearField)

    No error, "NearfieldMath1" is created.

    image

    Could you maybe attach your script here?

    Best regards,
    Torben

    User: "John Underwood"
    Altair Community Member
    OP
    Updated by John Underwood

    Hi Torben,

    I have figured out what the problem is.

    I was trying to perform the task using a "Custom" script under the "New Script" menu instead of running it as an external script.

    The script user document is not clear on this. I stumbled upon it when I clicked on "New" in the script editor.

    **** Just found in the script document (under "General Scripts") where the above is explained. ***

    Thanks for your help.

    Regards,

    John