# push/pop operation

## Syntax

• [ operations ]

## Parameters

1. operations
A sequence of shape operations to execute.

## Description

The [ operation pushes the current shape onto the top of the shape stack. It must be matched by a succeeding ] operation, which pops the shape on top of the shape stack and deletes the shape.

## Examples

### Rotation

 In this example, the extruded shape is rotated three times and assigned to a new shape (X). The rotations build on each other.``````Lot--> extrude(15) r(scopeCenter, 0, 22.5, 0) X r(scopeCenter, 0, 22.5, 0) X r(scopeCenter, 0, 22.5, 0) X`````` Encapsulating the rotations and "create shape" operations with a push/pop pair makes all X coincide. The rotations are independent of each other.``````Lot--> extrude(15) [ r(scopeCenter, 0, 22.5, 0) X ] [ r(scopeCenter, 0, 22.5, 0) X ] [ r(scopeCenter, 0, 22.5, 0) X ]``````

### House

 Both rules generate the same result. In the second rule, the roof is generated first using push/pop operations. ``````House --> extrude(10) comp(f) { top : roofHip(45) Roof. | all = House.} House --> [ t(0,10,0) roofHip(45) Roof. ] extrude(10) comp(f) { top : NIL | all = House. }``````

### Translation

 Cylinder assets are inserted five times. Each scope is translated based on the scope of the initial shape. ``````House--> Cylinder [ t( 0, 0, ' 1) Cylinder ] [ t( 0, 0, '-1) Cylinder ] [ t(' 1, 0, 0) Cylinder ] [ t('-1, 0, 0) Cylinder ] Cylinder --> primitiveCylinder(16, 1, 2)``````

### Condition

 Conditional and stochastic statements must not have preceding operations. Use push and pop to encapsulate a case switch. ``````Lot --> s(1,1,1) [ case scope.sx == 1 : primitiveCube() Cube. else : primitiveCylinder() Cylinder. ]``````