---
title: "snapToLocal"
canonical: "https://help.vicon.com/space/ShogunPost121/1253736854/snapToLocal"
format: markdown
---
# Description

Snaps a named node to the position and rotation defined by the local coordinate system of the selected node.

The snapToLocal command differs from [snapToSystem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737770), [snapToSystemAlign](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737280), and [snapToRigid](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737073) in that snapToLocal only requires one node be selected to define the coordinate system.

## Functional area

Snap

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `snapToLocal "targetNodeName" offsetX offsetY offsetZ [-allTime] [-positionOnly] [-rotationOnly] [-ranges]` |

### Arguments

> Macro (scroll-tablelayout)

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `targetNodeName` | string | yes | Name of the node that will be snapped. |
| `OffsetX` | float | yes | Specifies the position offset to apply to the object being snapped on the X axis of the space defined by the selected markers. |
| `OffsetY` | float | yes | Specifies the position offset to apply to the object being snapped on the Y axis of the space defined by the selected markers. |
| `OffsetZ` | float | yes | Specifies the position offset to apply to the object being snapped on the Z axis of the space defined by the selected markers. |

> Macro (scroll-pagebreak)

### Flags

> Macro (scroll-tablelayout)

| Name | Flag arguments | Argument type | Exclusive to | Comments |
| --- | --- | --- | --- | --- |
| `all time` | 0 | — | ranges | Performs the snap over the entire animation range. |
| `positionOnly` | 0 | — | rotationOnly | Only modifies the position of the node being snapped. |
| `rotationOnly` | 0 | — | positionOnly | Only modifies the rotation of the node being snapped. |
| `absolute` | 0 | — | — | Specifies the offset is in mm rather then a percentage of the distance between the first two nodes that define the system. |
| `ranges` | 0 | — | allTime | Performs the snap over the selected time ranges. |

## Return value

void

## Examples

```plaintext
// Create a marker and set its translation and rotation in space 
// then create a second marker and snap it relative to the first
// markers system.
create Marker "marker1";
setProperty Translation 200 0 200 -d ;
setProperty Rotation 0 45 45 -d;
create Marker "marker2";
select marker1;
snapToLocal "marker2" 100 100 100;
```

> Macro (scroll-pagebreak)

# Additional information

## Related commands

- [snapTo](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737795)
- [snapToConstraint](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736474)
- [snapToLine](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736528)
- [snapToRigid](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737073)
- [snapToSystem](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737770)
- [snapToSystemAlign](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737280)