# `GSPath cleanUpGrid:`

*Instance Method*

Removes redundant nodes and rounds node positions to a grid.

## Declaration

```swift
func cleanUpGrid(_ grid: GSGridSettings)
```

```objc
- (void) cleanUpGrid:(GSGridSettings) grid;
```

```python
cleanUpGrid_(grid: GSGridSettings)
```

## Discussion

Cleanup removes nodes that do not affect the path shape within the cleanup tolerance. Node positions are rounded when the grid is meaningful. It also closes an open path when its endpoints are nearly coincident.

## See Also

### Cleanup

- [`GSPath cleanUp`](/Core/GlyphsCore/GSPath/cleanUp) — Removes redundant nodes and rounds node positions to the layer grid.
- [`GSPath findRequiredNodeIndexes:grid:`](/Core/GlyphsCore/GSPath/findRequiredNodeIndexes:grid:) — Adds the node indices that cleanup would keep.
- [`GSPath removeDuplicateNodes`](/Core/GlyphsCore/GSPath/removeDuplicateNodes) — Removes adjacent on-curve nodes at the same position.

