Skip to documentation
DocumentationAll documentsEnglish

GRID(nged)

NAME

grid - control the display grid and snap-to-grid behavior

On this page

SYNOPSIS

grid vname parameter [value]

DESCRIPTION

The grid command controls the view grid: a regular overlay of horizontal and vertical lines drawn on the display to aid in alignment and measurement. It also controls snap-to-grid behavior, which constrains view center movement to the nearest grid intersection.

The first argument vname is the name of the view to configure. The second argument parameter specifies which grid attribute to get or set. If a value is provided it sets the attribute; if omitted the current value is returned.

Parameters

Parameter Value Description

color

r g b

Get or set the grid line color as three integers (0–255). With no value, returns current color.

draw

0 or 1

Enable (1) or disable (0) grid display. With no value, returns current draw state.

snap

0 or 1

Enable (1) or disable (0) snap-to-grid. With no value, returns current snap state.

rh

float

Get or set the horizontal grid resolution (spacing) in the current working units.

rv

float

Get or set the vertical grid resolution (spacing) in the current working units.

mrh

integer

Get or set the major grid line interval (horizontal): a major line is drawn every N minor lines.

mrv

integer

Get or set the major grid line interval (vertical).

vsnap

(none)

Snap the current view center to the nearest grid intersection. Takes no value argument.

EXAMPLES

Example 1. Enable the grid

mged> grid default draw 1

Turns on grid display for the view named default.

Example 2. Set grid spacing to 10 mm

mged> grid default rh 10 mged> grid default rv 10

Sets horizontal and vertical grid spacing to 10 units in the current working units.

Example 3. Enable snap-to-grid

mged> grid default snap 1

Enables snap-to-grid for the default view. The view center will snap to the nearest grid point during interactive navigation.

Example 4. Set grid color to green

mged> grid default color 0 200 0

Sets the grid line color to green (R=0, G=200, B=0).

Example 5. Get the current horizontal resolution

mged> grid default rh

Returns the current horizontal grid resolution in working units, for example: 10.

Example 6. Snap view center to nearest grid point

mged> grid default vsnap

Moves the view center to the nearest grid intersection.

SEE ALSO

view(nged), center(nged)

AUTHOR

BRL-CAD Team

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org