Navigation: Tools Commands > Edit/View Pre/Post Update Script

 

Edit/View Pre/Post Update Script

 

Contact Us: fredsupport@photonengr.com

 

 

 

Description


This feature allows editing of the pre-update and post-update scripts associated with a FRED document.  When a change is made to a FRED model, the document being modified undergoes an update cycle.  The update cycle is a process that ensures the integrity of the model by applying the requested changes to the internal database after accounting for all of the complex interdependencies between elements.  At a high level, the update cycle takes the following steps when triggered (by hitting Apply or OK on a dialog in the GUI or by calling the Update subroutine from scripting):

 

1.

 

Pre-Update Script Execution

2.

 

"FNode" (Sources, Geometry, Analysis Surfaces) Tree Update

          a. Apply Pickups

          b. Pre-Update Loop

          c. FNode Update Loop

          d. Linear Transformation Updates

          e. Trimming Volume Updates

          f. Post-Update Loop

3.

 

Prosperity Updates (Materials, Coatings, etc.)

4.

 

Post-Update Script Execution

 

 

In the context of the update cycle, the pre-update script will execute and operate on the current state of the document, the document undergoes the FNode Tree Update and Property Updates, and then the post-update script will execute and operate on the new state of the document.

 

Suppose that the user wanted to construct a model in which the center of curvature for surface A is always centered on surface B.  Such a dependency requires that if the position of surface B is ever modified, surface A is automatically updated without requiring the user's interaction.  In this context, a post-update script can be written which checks the current location of surface B and then modifies the center of curvature for surface A as required.  The post-update script will then be executed every time the model finishes the update cycle and the desired dependency between surface A and B is always valid without specific interaction by the user.

 

Another very common usage of pre and post update scripts is to pair them with the Global Script Variables in order to facilitate parameterization of the model through the GUI.  The pre-update script would check the global script variable values and modify the corresponding elements as required at the start of the update cycle.

 

 

Navigation


This feature can be accessed by selecting Tools > Edit/View Pre/Post-Update Script from the menu.

 

 

Controls


Control

Inputs / Description

Defaults

Edit Area

Displays the script.

 

Run script during every update

Runs the script either before or after (pre- or post-update, respectively) any update is performed.

Unchecked

 

OK

Accept settings and close dialog box.

 

Cancel

Discard settings and close dialog box.

 

Apply

Apply settings and keep dialog box open.

 

Test

Tests script for compilation.

 

Help

Access this Help page.

 

 

 

Application Notes


Calling Update from Pre and Post Update Scripts

The Update command cannot be executed from a Pre-Update script. It is quite common to setup post-update scripts that themselves modify entities within the document.  However, keep in mind that the post-update script is executed at the END of the update cycle.  If the user writes a post-update script that itself modifies the document, the post-update script should call the Update command at the end (otherwise the changes will not be committed).  When an Update call is issued from a post-update script, the pre and post update scripts will not be executed a second time.

 

 

Related Topics


Global Script Variables dialog

Tools Menu Summary

 

 

 

 

 

Copyright © Photon Engineering, LLC