Attributes are a set of static global variables defined in the rule file. Each attribute is initialized to a specific value in the rule file. The attribute values can individually be controlled on a per shape basis; this can be done in the Rules pane in the inspector.


attr height = 150
attr landuse = "residential"

Lot --> extrude(height) Envelope(landuse)

Here, two attributes are defined using the attr keyword: height which is of type float and landuse which is a string. The attributes are used in the Lot rule.

Attributes can also be conditional or stochastic:

attr landuse = 50%: "residential" 
               else: "industrial"

Here, there is a 50% chance landuse evaluates to "residential" and a 50% chance it evaluates to "industrial". Note: in contrast to functions, which are going to be explained in the next section, conditional and stochastic attributes are evaluated only once during the generation process. If a rule is assigned to more than one shape, for each shape the conditional/stochastic attributes are evaluated to a value once and then keep that value.

In the same way, the rand() function can be used:

attr height = rand(30,50)

Lot --> extrude(height) Envelope

Envelope --> 
    case height < 40: SmallBuilding
    else: LargeBuilding

For each shape which has the start rule Lot, height evaluates to a value between 30 and 50 units. This height can then be used everywhere in the rule file and always stays constant.


See Mapping Parameters for details how to use different sources to control input of rule attributes.

The display of attributes in the Inspector can be controlled by CGA annotations.

Interactive Handles can be used to edit attributes in the 3D view.


Copyright ©2008-2018 Esri R&D Center Zurich. All rights reserved.