pymel.core.modeling.grid

grid(*args, **kwargs)

This command changes the size and spacing of lines on the ground plane displayed in the perspective and orthographic views. This command lets you reset the ground plane, change its size and grid line spacing, grid subdivisions and display options. In query mode, return type is based on queried flag.

Flags:
Long name (short name) Argument Types Properties
default (df) bool ../../../_images/query.gif
 
Used to specify/query default values.
displayAxes (da) bool ../../../_images/query.gif
 
Specify true to display the grid axes.
displayAxesBold (dab) bool ../../../_images/query.gif
 
Specify true to accent the grid axes by drawing them with a thicker line.
displayDivisionLines (ddl) bool ../../../_images/query.gif
 
Specify true to display the subdivision lines between grid lines.
displayGridLines (dgl) bool ../../../_images/query.gif
 
Specify true to display the grid lines.
displayOrthographicLabels (dol) bool ../../../_images/query.gif
 
Specify true to display the grid line numeric labels in the orthographic views.
displayPerspectiveLabels (dpl) bool ../../../_images/query.gif
 
Specify true to display the grid line numeric labels in the perspective view.
divisions (d) int ../../../_images/query.gif
 

Sets the number of subdivisions between major grid lines. The default is 5. If the spacing is 5 units, setting divisions to 5 will cause division lines to appear 1 unit apart.

orthographicLabelPosition (olp) unicode ../../../_images/query.gif
 
The position of the grid’s numeric labels in orthographic views. Valid values are axisand edge.
perspectiveLabelPosition (plp) unicode ../../../_images/query.gif
 
The position of the grid’s numeric labels in perspective views. Valid values are axisand edge.
reset (r) bool  
 
Resets the ground plane to its default values
size (s) float ../../../_images/query.gif
 
Sets the size of the grid in linear units. The default is 12 units.
spacing (sp) float ../../../_images/query.gif
 
Sets the spacing between major grid lines in linear units. The default is 5 units.
style (st) int ../../../_images/query.gif
 
This flag is obsolete and should not be used. Flag can have multiple arguments, passed either as a tuple or a list.
toggle (tgl) bool ../../../_images/query.gif
 
Turns the ground plane display off in all windows, including orthographic windows. Default is true.

Derived from mel command maya.cmds.grid

Example:

import pymel.core as pm

#To toggle the grid display of the grid (in all views):
currState = pm.grid( toggle=True, q=True )
pm.grid( toggle=(currState == 0) )

# To reset the grid to default values:
pm.grid( reset=True )

# To change the grid spacing and subdivisions:
pm.grid( spacing=10, d=10 )

# To set the defaults for inches
pm.grid( default=True, spacing='1in', size='1ft', divisions=4 )

# To change the size of the grid to 20x20, extending 10 units
# in each direction:
pm.grid( spacing=10 )

# To query the current size of the grid:
# returns a size in the current linear unit.
pm.grid( query=True, size=True )
# Result: 12.0 #

# A typical grid would be a grid size of 20x20, with
# major grid lines every 5 units, with 5 divisions between
# major grid lines. This be done with the following command.
pm.grid( size='10cm', sp='5.0cm', d=5 )

# Turn on numeric grid labels.
#
pm.grid( displayPerspectiveLabels=True )

# Display grid labels along the axes.
#
pm.grid( perspectiveLabelPosition='axis' )

Previous topic

pymel.core.modeling.globalStitch

Next topic

pymel.core.modeling.hardenPointCurve

Core

Core Modules

Other Modules

This Page