Files
florian.berthold 1ae49dc1bb Add 8HP layout with fully automated routing pipeline
- Update PCB to 8HP format (40x100mm) with v2 component placement
- Add automated routing scripts (autoroute.py runs full pipeline headlessly)
- Update panel spec and SVG for 8HP dimensions
- Board routes in <1 second with 0 unconnected pads

Scripts:
- autoroute.py: Full CLI pipeline (place → export → route → import → DRC)
- autoroute_full.py: Same pipeline for KiCad scripting console
- place_8hp.py: Component placement only
- route.sh/freeroute.sh: Routing helpers
2026-01-23 07:59:50 +01:00

46 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
Move board and all components to origin (0,0)
Run in KiCad PCB Editor: Tools → Scripting Console
Then: exec(open('scripts/move_to_origin.py').read())
"""
import pcbnew
board = pcbnew.GetBoard()
# Get current board origin from edge cuts
bbox = board.GetBoardEdgesBoundingBox()
offset_x = bbox.GetX()
offset_y = bbox.GetY()
print(f"Current board origin: ({pcbnew.ToMM(offset_x):.2f}, {pcbnew.ToMM(offset_y):.2f}) mm")
if offset_x == 0 and offset_y == 0:
print("Board is already at origin!")
else:
# Move all footprints
for fp in board.GetFootprints():
pos = fp.GetPosition()
new_pos = pcbnew.VECTOR2I(pos.x - offset_x, pos.y - offset_y)
fp.SetPosition(new_pos)
# Move all drawings (including board outline)
for drawing in board.GetDrawings():
if hasattr(drawing, 'Move'):
drawing.Move(pcbnew.VECTOR2I(-offset_x, -offset_y))
# Move all tracks
for track in board.GetTracks():
track.Move(pcbnew.VECTOR2I(-offset_x, -offset_y))
# Move all zones
for zone in board.Zones():
zone.Move(pcbnew.VECTOR2I(-offset_x, -offset_y))
print(f"Moved everything by ({-pcbnew.ToMM(offset_x):.2f}, {-pcbnew.ToMM(offset_y):.2f}) mm")
print("Board is now at origin (0, 0)")
pcbnew.Refresh()
print("\nDone! Save (Ctrl+S), delete all tracks, then run place_6hp.py")