# splitArea

### Syntax

• splitArea(axis) { area1 : operations1 | area2 : operations2 | … | arean-1operationsn-1 }
• splitArea(axis) { area1 : operations1 | area2 : operations2 | … | arean-1operationsn-1 }*
• splitArea(axis, adjustMode) { area1 : operations1 | … | arean-1 : operationsn-1 }
• splitArea(axis, adjustMode) { area1 : operations1 | … | arean-1 : operationsn-1 }*

### Parameters

1. axisselector{ x | y | z }—Name of axis to split along. This is relative to the local coordinate system (i.e. the scope).
2. adjustMode{ adjust | noAdjust }—Optional selector to control scope calculation of the calculated shapes. The default is to adjust the scope to the geometry’s bounding box. Using noAdjust avoids this, and therefore, the scopes of the resulting shapes fill the parent’s scope without gaps.
3. areafloatSplit area. The current shape is split such that the resulting shape has the specified area. Depending on the prefix, the area is interpreted in the following way:
• no prefix(absolute) —The new shape will have exactly the same area.
• ‘ (relative) —The new shape’s size will be area * current geometry’s area.
• ~ (floating) —With the ~ prefix the remaining spaces between the split parts with absolute dimensions are automatically adapted. If multiple floating parts are defined within a split, the dimensions are weighed proportionally.
4. operationsA sequence of shape operations to execute on the newly created shape.
5. *Repeat switch: the repeat switch triggers the repetition of the defined split into the current shape’s scope, as many times as possible. The number of repetitions and floating dimensions are adapted to the best solution (best number of repetitions and least stretching).

### Description

The splitArea operation subdivides the geometry of the current shape along the specified scope axis into a set of shapes with geometric areas specified by the area parameter. This operation works on planar 2D geometry and almost planar geometry. The area accuracy breaks down with nonplanar geometry. This operation does not apply to 3D geometry such as meshes or highly nonplanar geometry.

For each specified area, the current shape’s geometry is cut with planes perpendicular to the split axis such that the resulting shape contains geometry with the specified area.

The optional repeat switch * can be used to repeat the content within a { … }* block as many times as it fully fits into the scope’s dimension along the selected axis.

### Examples

#### Colors

These are the rules for the colors used in the following examples.

``````Red     -->                          // red
color(1, 0, 0)
print("area(R) = " + geometry.area)

Yellow  -->                         // yellow
color(1, 1, 0)
print("area(Y) = " + geometry.area)

Green   -->                         // green
color(0, 1, 0)
print("area(G) = " + geometry.area)

Cyan    -->                         // cyan
color(0, 1, 1)
print("area(C) = " + geometry.area)

Blue    -->                         // blue
color(0, 0, 1)
print("area(B) = " + geometry.area)

Magenta -->                         // magenta
color(1, 0, 1)
print("area(M) = " + geometry.area)

Pink    -->                         // semi-transparent pink
color(1, 0.5, 0.5, 0.3)``````