Loop for Objects in Layer
Loop for objects in layer enables you to export objects stored in Information type layers from within a grid or a mesh export template. Future version which will feature export templates for information type layers, will support this loop type as well.
Using Information Type Layer Functions
You can use all available information type layer functions from within this loop. The following example exports all contours in a layer called Domain Outline and for each object exports its name, area, length, type and value of the parameter named Density. It also exports for every contour the X and Y coordinates of its vertices.
Nesting Loop for Objects in Layer within Loops for Blocks or Elements
You may nest a loop for Object in Layer within a loop over blocks and elements. This enables you to export all objects in a layer which intersect or are contained within a block or an element. Usually you will need to export information by block, however, if your code requires that you list all the objects in all layers per block or element you can nest a loop over objects in layer, within a loop over blocks or elements within a loop over layers.
The following example exports for each blocks the length of intersection of contours in each layer named rivers1, rivers2 and rivers3, as well as the area of intersection between each block and contours in each of the layers named lakes1, lakes2 and lakes3. The functions ContourIntersectLength() and ContourIntersectArea() which are unique to Loop for Object in Layer are described below. Also the use of square brackets as loop variable is also explained below.
Functions unique to loop for objects in layer when nested within a loop for blocks or elements
Example: In the following illustration the bottom-left block is tested for ContourIntersectArea() and returns for each of the two contours intersecting it, the area of intersection (marked by a different hatch pattern). The areas returned may be exported, added or manipulated using other functions.
Example: In the following illustration the bottom-left block is tested for ContourIntersectLength() and returns for each of the two contours intersecting it the length of intersection (marked by a thick line). The lengths returned may exported, added or manipulated using other functions.
Looping Over Numbered Layers and Parameters
The square brackets  notation allows one to automatically concatenate layers and parameter names with a loop variable. This allows you to repeat a sequence of an export template without prior knowledge of the numbers of layers to be exported.
In the following example NumLayers is either a global variable (see"Global Variables" on page 21s in this supplement) or a PIE variable which is set to the number of parameters sharing a name such as Grid.Perm Unit1, Grid.Perm Unit2, etc. As the loop progresses the loop variable i, the layer's and parameter's name, appearing before the square brackets, is concatenated with the value of i to produce the actual parameter name.
Loop for: Variable i from: 1 to: NumLayers step: 1
Export matrix: Grid.Perm Unit[i] [G0]
Using arrays in exported templates is supported through an Array PIE. This PIE allows one to initialize, set and get values of a one dimensional array. Any number of such arrays can be used. For details regarding the use of Array PIEs refer to "Array PIEs" on page 53.
To the next page