ReferenceconstrainToGrid

<constrainToGrid/>

<constrainToGrid> is a Graphical component that is used to constrain a <point> to a grid. The grid can be the default 1×11 \times 1 grid, or a custom grid defined by the dx and dy attributes, or by the xOffset and yOffset attributes.

<constrainToGrid/> forces points to snap to gridline locations. The <constrainToGrid/> component is nested within a <constraints> block.

Attributes and Properties

Attributes for <constrainToGrid>
AttributeTypeValues
dx = "…"number
dy = "…"number
dz = "…"number
xoffset = "…"number
yoffset = "…"number
zoffset = "…"number
Props for <constrainToGrid name="c">
PropertyType
$c.disabledboolean
$c.dxnumber
$c.dynumber
$c.dznumber
$c.fixedboolean
$c.fixLocationboolean
$c.hiddenboolean
$c.xoffsetnumber
$c.yoffsetnumber
$c.zoffsetnumber

Example: Constrain a <point> to the default grid

The <point> is constrained to the default 1×11 \times 1 grid.


Example: Constrain a <circle> to the default grid

To constrain geometric objects other than points, first define a named <point> with the desired constraint, and then reference that point within the definition of the geometric object. The original <point> can be hidden using the hide attribute.


Example: Constrain a <point> to a custom grid

The <point> is constrained to a custom 0.5×0.50.5 \times 0.5 grid.


Attribute Example: dx, dy

The <point> is constrained to a custom grid using the dx and dy components. The grid specified for the <graph> does not affect the constraint grid, it is merely adjusted to match in this example for illustration.


Attribute Example: xOffset, yOffset

The <point> is constrained to the default 1×11 \times 1 grid with a specified xOffset and yOffset of 0.50.5.