Magic-8.3 Command Reference

#

## grid

Toggle the grid lines on or off, and set grid parameters

### Shortcuts:

> Key macro g implements the command grid (with no arguments). Key macro G implements the command grid 2.

### Usage:

> grid [option]

> > where option may be one of the following:
> > x_spacing [y_spacing [x_origin y_origin]]
> >   set the grid to the indicated spacing, where all spacing and origin values are any valid magic distance value.
> > on|off
> >   Set the visibility of the grid on or off, as indicated.
> > state
> >   Report the state (on or off) of the grid. In the Tcl version, this is returned as a boolean value (0 or 1).
> > box
> >   Report the box (rectangle) of the unit grid, in magic internal coordinates.
> > help
> >   Print usage information on the grid command.

### Summary:

> The grid command has two purposes: to draw a reference grid on the screen as an aid to layout placement, and to define a snap grid of arbitrary (and not necessarily square) units. This second use works in conjunction with the snap command; with the invocation of snap grid (or, equivalently, snap user), standard magic dimensions for commands such as move, copy, box, stretch, and mouse-button movement of the cursor box are parsed as integer divisions of the user grid. The grid does not have to be visible ("grid on") for the snap function to be enabled.

> Note that the grid has both spacing values and an offset; unlike the lambda grid, which is always aligned to the internal coordinate system, the user grid may be any value; for grid spacings that are not a multiple of internal or lambda values, the grid may need to be offset from the origin to get the desired alignment. To do this, specify the x_origin and y_origin values, which describe the offset of the grid origin from the internal coordinate system origin.

> Usually there is no reason to have different x_spacing and y_spacing values (only one spacing value is required for both). However, occasionally it may be useful to define something like the following:

> > grid 150um 3l; snap grid

> This example makes it easy to draw a number of horizontal routing lines aligned to a pad cell spacing of 150 microns.

> Note that even when the grid is set to visible, at a large enough zoom factor, where the grid lines become dense, the grid will not be drawn.

> grid with no arguments toggles the visibility of the grid lines on the screen.

### Implementation Notes:

> grid is implemented as a built-in window command in magic.

### See Also:

> snap

Return to command index

Last updated: March 7, 2020 at 1:06pm