# `GSPath segmentAtNodeIndex:`

*Instance Method*

The segment associated with a node index.

## Declaration

```swift
func segment(atNodeIndex idx: Int) -> GSPathSegment?
```

```objc
- (GSPathSegment *) segmentAtNodeIndex:(NSInteger) idx;
```

```python
segmentAtNodeIndex_(idx: int) -> GSPathSegment
```

## Discussion

Off-curve node indices resolve to the following on-curve node.

Returns `nil` when no segment can be resolved for the index.

## See Also

### Segments

- [`GSPath.segments`](/Core/GlyphsCore/GSPath/segments) — The path represented as path segments.
- [`GSPath.segmentsFast`](/Core/GlyphsCore/GSPath/segmentsFast) — The path represented as path segments without collecting path object information.
- [`GSPath segmentAtNodeIndex:segmentStartIndex:segmentEndIndex:`](/Core/GlyphsCore/GSPath/segmentAtNodeIndex:segmentStartIndex:segmentEndIndex:) — The segment associated with a node index and the node index range it covers.

