laylight tour
0/25
1/6

Shapes and placement · 1 of 6

Anchors

place wg at (0, 0) moved the center of the rectangle to the origin. Every shape has an origin — for a rectangle, its center — and place uses it unless told otherwise.

Every shape also has anchors on its bounding box:

top_left       top_center       top_right
left_center      center      right_center
bottom_left   bottom_center   bottom_right

Name an anchor after a dot, and place moves the shape so that this anchor lands on the target:

place wg.left_center at (0, 0)     # the waveguide starts at the origin
place pad.bottom_left at (0, 0)    # the corner of the pad is at the origin

wg.origin names the origin itself. A shape also knows its size: wg.width and wg.height are the width and the height of its bounding box.

Exercise

The bars of the chart hang around their centers. Stand them on the x axis: put their bottom-left corners at (0, 0), (3 µm, 0) and (6 µm, 0).

loading compiler…

Edit the code, watch the layout, then press Submit to check your solution against the exercise.

Compiling…