e4c7119c51
🎉 Major v2.0 rebuild kickoff - Week 1 accomplished! ## Highlights ### Cross-Platform Support 🌍 - ✅ Linux primary platform (Ubuntu/Debian tested) - ✅ Windows fully supported - ✅ macOS experimental support - ✅ Platform-agnostic path handling (XDG spec) - ✅ Auto-detection of KiCAD installation ### Infrastructure 🏗️ - ✅ GitHub Actions CI/CD pipeline - ✅ Pytest framework with 20+ tests - ✅ Pre-commit hooks (Black, MyPy, ESLint) - ✅ Automated Linux installation script - ✅ Enhanced npm scripts ### IPC API Migration Prep 🚀 - ✅ Comprehensive migration plan (30 pages) - ✅ Backend abstraction layer (800+ lines) - ✅ Factory pattern with auto-detection - ✅ SWIG backward compatibility wrapper - ✅ IPC backend skeleton ready ### Documentation 📚 - ✅ Updated README (Linux installation) - ✅ CONTRIBUTING.md guide - ✅ Linux compatibility audit - ✅ IPC API migration plan - ✅ Session summaries - ✅ Platform-specific config templates ## Files Changed - 27 files created - ~3,000 lines of code/docs - 8 comprehensive documentation pages - 20+ unit tests - 5 abstraction layer modules ## Next Steps - Week 2: IPC API migration (project.py → component.py → routing.py) - Migrate from deprecated SWIG to official IPC API - JLCPCB/Digikey integration prep 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
2.2 KiB
Python
68 lines
2.2 KiB
Python
"""
|
|
Board size command implementations for KiCAD interface
|
|
"""
|
|
|
|
import pcbnew
|
|
import logging
|
|
from typing import Dict, Any, Optional
|
|
|
|
logger = logging.getLogger('kicad_interface')
|
|
|
|
class BoardSizeCommands:
|
|
"""Handles board size operations"""
|
|
|
|
def __init__(self, board: Optional[pcbnew.BOARD] = None):
|
|
"""Initialize with optional board instance"""
|
|
self.board = board
|
|
|
|
def set_board_size(self, params: Dict[str, Any]) -> Dict[str, Any]:
|
|
"""Set the size of the PCB board"""
|
|
try:
|
|
if not self.board:
|
|
return {
|
|
"success": False,
|
|
"message": "No board is loaded",
|
|
"errorDetails": "Load or create a board first"
|
|
}
|
|
|
|
width = params.get("width")
|
|
height = params.get("height")
|
|
unit = params.get("unit", "mm")
|
|
|
|
if width is None or height is None:
|
|
return {
|
|
"success": False,
|
|
"message": "Missing dimensions",
|
|
"errorDetails": "Both width and height are required"
|
|
}
|
|
|
|
# Convert to internal units (nanometers)
|
|
scale = 1000000 if unit == "mm" else 25400000 # mm or inch to nm
|
|
width_nm = int(width * scale)
|
|
height_nm = int(height * scale)
|
|
|
|
# Set board size
|
|
board_box = self.board.GetBoardEdgesBoundingBox()
|
|
board_box.SetSize(pcbnew.VECTOR2I(width_nm, height_nm))
|
|
|
|
# Update board outline
|
|
self.board.SetBoardEdgesBoundingBox(board_box)
|
|
|
|
return {
|
|
"success": True,
|
|
"message": f"Set board size to {width}x{height} {unit}",
|
|
"size": {
|
|
"width": width,
|
|
"height": height,
|
|
"unit": unit
|
|
}
|
|
}
|
|
|
|
except Exception as e:
|
|
logger.error(f"Error setting board size: {str(e)}")
|
|
return {
|
|
"success": False,
|
|
"message": "Failed to set board size",
|
|
"errorDetails": str(e)
|
|
}
|