How can I animate the analysis grid with a script?

I have a calculated 3D analysis grid which I can use the slider to manually reposition the displayed axial section through. How can I animate this same axial section using an Ecotect script?

The following script shows you how to animate the position of the base 2D analysis grid within a set of 3D calculation results. It uses one of the example models that comes with Ecotect, but you can use your own model by simply commenting out line 4.

The key to using this script is to have already calculated full 3D dataset. Many of the calculation wizards in Ecotect provide an option for this when you select the Analysis Grid as the method for storing results. Without it, the base 2D analysis grid section won't move as it will only have results for its current position.

-- For demonstration purposes only, this 
-- script loads an example model. Simply comment 
-- out the following line to use your own.
cmd("model.load", "Examples\\") 

-- Set number of animated increments.
frame_count = 80;

-- Get min/max range in current axis.
minbase, maxbase = get("grid.range");

-- Work out frame increment.
inc = (maxbase - minbase) / frame_count;

-- Uncomment the following line to print values.
-- printf("Extents: %g, %g", minbase, maxbase);

-- Show the opengl view.

-- Move to the view from the 3rd camera.
cmd("", 3) 

-- Cycle forwards.
for i = minbase, maxbase, inc do
	set("grid.base", i);

-- Cycle backwards.
for i = maxbase, minbase, -inc do
	set("grid.base", i);

View desktop or mobile version of site.