Add optional standard Y-axis coordinate system
Problem
KiCAD uses an inverted Y-axis (like computer graphics):
- Higher Y values = lower on screen (Y=120 is below Y=100)
- Lower Y values = higher on screen (Y=100 is above Y=120)
This is opposite from standard math/physics where +Y goes up. This creates several issues:
- Cognitive load: Users must mentally flip coordinates when designing
- LLM performance: Language models trained on standard coordinate systems struggle with inverted Y-axis
- Code readability: Circuit descriptions like "place R2 below R1" require counter-intuitive higher Y values
- Educational barrier: New users from math/science backgrounds find this confusing
Proposed Solution
Add a global configuration option to use standard Y-axis orientation:
import kicad_sch_api as ksa
# Enable standard Y-axis (higher Y = higher on screen)
ksa.config.positioning.use_standard_y_axis = True
# Now Y increases upward (like standard math)
sch.components.add('Device:R', 'R1', '10k', position=(100, 100)) # Higher on screen
sch.components.add('Device:R', 'R2', '10k', position=(100, 80)) # Lower on screen (smaller Y)
Implementation Details
When use_standard_y_axis = True:
- All input Y coordinates are flipped before being written to KiCAD format
- All output Y coordinates are flipped when reading from KiCAD format
- The KiCAD file format remains unchanged (still uses inverted Y-axis)
- Only affects the Python API interface
Technical Approach
Add Y-axis conversion in the core positioning methods:
def _convert_y(y: float, invert: bool = False) -> float:
"""Convert Y coordinate based on axis configuration."""
if config.positioning.use_standard_y_axis:
# Flip Y-axis to/from KiCAD's inverted system
# Need a reference point - could use schematic bounds or origin
return -y if invert else y
return y
Benefits
- Improved LLM performance: AI models can reason about circuits using standard coordinates
- Better UX: More intuitive for users from math/science/engineering backgrounds
- Backward compatible: Default behavior unchanged (inverted Y-axis matches KiCAD)
- Educational: Easier to teach and learn circuit generation
Considerations
- Need to define a Y-axis origin/reference point for the flip
- Should work seamlessly with grid units
- All positioning methods must be updated consistently
- Documentation should explain both modes
Related
This complements existing positioning improvements:
- Grid units configuration (#existing-issue)
- Parametric positioning with
p() helper
- Auto-routing API
Use Cases
Circuit generation by LLMs:
# LLM can now use natural language → standard coordinates
"Place R2 below R1" → R2.y < R1.y (standard Y-axis)
vs.
"Place R2 below R1" → R2.y > R1.y (inverted Y-axis - confusing!)
Educational examples:
# Draw voltage divider from top to bottom
sch.components.add('power:VCC', position=(50, 100)) # Top (high Y)
sch.components.add('Device:R', 'R1', position=(50, 80))
sch.components.add('Device:R', 'R2', position=(50, 60))
sch.components.add('power:GND', position=(50, 40)) # Bottom (low Y)
# Natural top-to-bottom ordering with decreasing Y values
Priority
Medium-High - This would significantly improve:
- AI/LLM-assisted circuit generation
- User experience for programmatic schematic creation
- Educational adoption of the library
Not urgent for current users who are accustomed to KiCAD conventions, but valuable for expanding the user base and AI applications.
Add optional standard Y-axis coordinate system
Problem
KiCAD uses an inverted Y-axis (like computer graphics):
This is opposite from standard math/physics where +Y goes up. This creates several issues:
Proposed Solution
Add a global configuration option to use standard Y-axis orientation:
Implementation Details
When
use_standard_y_axis = True:Technical Approach
Add Y-axis conversion in the core positioning methods:
Benefits
Considerations
Related
This complements existing positioning improvements:
p()helperUse Cases
Circuit generation by LLMs:
Educational examples:
Priority
Medium-High - This would significantly improve:
Not urgent for current users who are accustomed to KiCAD conventions, but valuable for expanding the user base and AI applications.