How to clear all existing tracks on a PCB in KiCad to prepare for new routing using Python?
To clear all existing tracks on a PCB in KiCad for new routing, Python scripting can be used. The given script iterates through and removes all tracks from the board, providing a clean slate for new routing:

```python
import pcbnew

board = pcbnew.GetBoard()
for t in board.GetTracks():
    board.Delete(t)

pcbnew.Refresh()
```

This script is ideal when you need to redo the routing from scratch, whether due to major design changes or to optimize the existing layout.