Shapes and placement · 2 of 6
Placing shapes on shapes
The target of a placement does not have to be a fixed point. It can be an anchor of another shape:
place wg.left_center at self.origin
place body.left_center at wg.right_centerself.origin is the origin of the cell being defined. The second line attaches body to the right end of wg, wherever wg ends up. offset shifts a placement by a vector:
place out.left_center at body.right_center offset (0, 1um)Placement is declarative. The order of the statements does not matter — a placement may refer to a shape defined or placed further down — and laylight works out the positions when they are needed. Two rules keep this well defined:
- every shape is placed exactly once, and a shape that is never placed is an error;
- placements cannot go round in a circle, like
aplaced onbplaced ona.
Because a shape is placed only once, drawing the same shape twice takes a copy. clone wg as wg2 creates a new shape with the same geometry, on the same layer, waiting to be placed.
Exercise
Complete the splitter. Attach body to the right end of input; then make two outputs by cloning input and attach them to the right side of body, shifted 1 µm up and 1 µm down.