Jump to content
Meerten

Scripting error: attempt to index global 'pf' (a nil value)

Recommended Posts

Hi,

 

I am trying to run a POSTFEKO script from my CADFEKO script. But when I want to run a function from my POSTFEKO script in my CADFEKO script it gives the following error: "attempt to index global 'pf' (a nil value)"

The code looks still messy, but I want to know why I cannot do a pf.GetApplication() when running from a CADFEKO project.

 

FEKO_automation_processing.lua

FEKO_pos_processing.lua

Share this post


Link to post
Share on other sites

Hi Meerten

 

As far as I know, you cannot call a function that uses POSTFEKO commands directly from within a CADFEKO script like in your example. The commands will be executed in CADFEKO at that point and "pf", the POSTFEKO namespace would not be available (see the User Manual chapter "Scripts and Application Programming Interface (API)" or Example Guide I1 "Introduction to Application Automation" for more information). You would have to use a command in the CADFEKO script that opens POSTFEKO with the post-processing script that you wish to execute. You could try something like the following:

 

cf.Launcher.Run("postfeko", {"modelname.fek", "--run-script", "createAndExportGraph.lua", "--non-interactive"})

 

You can run POSTFEKO in non-interactive mode, or you can leave out the last command if you wish to see the execution of commands or interact with POSTFEKO as the commands are being executed. You can close POSTFEKO in the post-processing script by using app:Close().

 

Here is a very simple example where CADFEKO is only used to run POSTFEKO to export a graph image:

As to sending parameters from CADFEKO to POSTFEKO, I'm not sure about the most elegant way to do this. One option would be to write/read the parameters to/from a (text) file using standard Lua commands.

 

Hope this helps.

 

Kind regards

Madelé

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...