Repetitive Elements

This section assumes you are very familiar with the concepts, terms and ideas for protograf as presented in the Basic Concepts , that you understand all of the Additional Concepts and that you’ve created some basic scripts of your own using the Core Shapes.

Overview

protograf allows you to directly define where elements, that make up your design, should be placed within a page, or over a series of Cards within a Deck, but it also includes commands that let you place, or “layout”, elements in a more repetitive or regular way within a page.

Very briefly, the different kinds of layout commands are as follows.

Linear layouts, where elements appear in one-dimensional space:

  • Sequence() - allows a set of elements to be placed at regular intervals in a straight line

  • Track() - the elements are positioned along the line used to delineate a shape; they can be placed either at the vertices of that line (e.g. at the corners of a square) or in the centre between two sequential vertices.

Grid-based layouts, where elements appear in two-dimensional space:

  • Repeat() - allows an element to be placed multiple times onto a grid

  • RectangularLocations() - defines a series of differing x- and y-points in a rectangular pattern; these x- and y-values will set the centre of any element being placed on the grid

  • TriangularLocations() - defines a series of differing x- and y-points in a triangular pattern; these x- and y-values will set the centre of any element being placed on the grid

  • DiamondLocations() - defines a series of differing x- and y-points in a diamond pattern; these x- and y-values will set the centre of any element being placed on the grid

These grid-based locations can be paired with a Layout() command, which associates them with the shapes that need to be drawn at their locations.

Hint

Hexagonal Grids are a special kind of repetition that can be more specifically customised; as are HexHex Grids

Sequences

The most basic repetition is that of a simple sequence, with elements placed at regular x- and y-positions in a linear direction.

See the Sequence section for details.

Tracks

Elements can be placed repetitively along a track.

A track can be defined as the border of a Rectangle or Polygon shape; or at specific angles along the circumference of a Circle.

The properties needed to construct this kind of repetition differ slightly from that of a simple linear sequence but the principle is the same. The track can be visible, or not.

See the Track section for details.

Repeats

Elements can also be placed repetitively via a repeat at grid locations within a page.

See the Repeat section for details.

Locations and Layouts

The other way that elements can be laid out repetitively on a page is through grid locations.

In protograf, such a grid can be derived from various built-in shapes — for example, Hexagons — or it can be constructed using a supplied set of properties. Because these grids do not themselves appear on the page, they are termed “virtual grids”.

A virtual grid is not specifically drawn on the page — unless there are settings provided for its fill or lines — rather it creates a set of point locations at which other elements can be drawn. This set of points can be used in a Layout command by:

  1. providing a sequence or list of elements, which are then drawn in the order specified by the “virtual grid” points, starting from a known point on the grid; or

  2. refering to each point directly, by using its identity, or grid reference, and then drawing the element at that point’s position; or

  3. using a combination of rows or columns to draw a shape multiple times at those sets of points.

Hint

The first approach is useful when the entire grid will be filled with a single element (or a repeating set of elements).

The second and third approaches are more suitable when only some locations of the grid need to be used, or if a much finer degree of control is needed with differing elements going into very specific — and possibly irregular — places that the script specifies.

There are the following kinds of locations:

  • RectangularLocations() - defines a series of differing x- and y-points in a rectangular pattern; these x- and y-values will set the centre of any element being placed on the grid

  • TriangularLocations() - defines a series of differing x- and y-points in a triangular pattern; these x- and y-values will set the centre of any element being placed on the grid

  • DiamondLocations() - defines a series of differing x- and y-points in a diamond pattern; these x- and y-values will set the centre of any element being placed on the grid