LayerNr

This page contains a short and a more detailed description of the global variable: LayerNr, that is reachable from the Pally URCap:

In Short: LayerNr

LayerNr

An integer representing the current layer number that is being palletized. The value is zero-based.

Possible values

  • Any integer between 0 and the (total number of layers - 1) for the current pattern

Example

If a pattern has seven layers, then when …

  • … Pally is palletizing the first layer, LayerNr = 0

  • … Pally is palletizing the seventh layer, LayerNr = 6

In Detail: LayerNr

The LayerNr variable can be used to figure out which layer is currently being palletized. It contains a zero-indexed value of the current active layer number, meaning that the first layer will have LayerNr = 0.

A zero-based variable, such as LayerNr, means that the first layer has a value of 0; the second layer has a value of 1; the third has a value of 2; and so on. This is sort of zero-indexing is common practice in many programming languages.

One can use the LayerNr in various ways, one example is shown below:

An example of how to use the LayerNr variable in an if-sentence in Polyscope

Here, an extra wait is added in the beforeZone-callback when the third layer is being palletized (i.e when LayerNr = 2).