Callback and State API

State is managed somewhat simply but in a limited fashion. All API methods take a final dictionary argument. This dictionary is limited to using string keys and number or string values. Within this limitation, simply add new keys, read old keys, clear the dictionary, etc. and it will be persisted across functions calls and across updates. When the Iterations Completed property is rest, the dictionary is also cleared out.

It is advisable for the callback script to initialize the dictionary at Iteration 1.

All API methods use a subset of the following arguments



Only return values from BeforeIterationEx are processed. Returns from all other functions are discarded.

  1. BeforeIteration(IterationNumber, ContainerList, State): This method is called before each iteration. Ideally used to initialize the state dictionary, open editors as required or initialize setups as needed for each iteration.
  2. BeforeIterationEx(IterationNumber, ContainerList, State): Similar to the BeforeIteration method except that this allows you to control the number of iterations via the return value.
  1. AfterIteration(IterationNumber, ContainerList, State): This method is called after each iteration. This can be used to copy result files over, check results, implement any possible convergence calculations, logging of results, etc.
  2. BeforeContainerRefresh(IterationNumber, Container, ContainerList, State): Is called before each of the coupled containers is refreshed. The "Container" argument represents the container about to be refreshed.
  3. AfterContainerRefresh(IterationNumber, Container, ContainerList, State): Is called after each of the coupled containers is refreshed. The "Container" argument represents the container just refreshed.
  4. BeforeContainerUpdate(IterationNumber, Container, ContainerList, State): Is called before each of the coupled containers is Update (after a refresh). The "Container" argument represents the container about to be updated.
  5. AfterContainerUpdate(IterationNumber, Container, ContainerList, State): Is called after each of the coupled containers is updated. The "Container" argument represents the container just updated.

If the callback scripts use other files to send commands to various containers (vb, js, apdl, python, etc.), all of those files are best saved in the user_files directory. This allows you to use FBGetUserFilePath(str) to get the absolute path of the file and allows the files to be packaged with any created archive.

Utility Functions



Output/Debugging Functions