Skip to content

Commit

Permalink
[Fixed] Rotated text in worksheet for KiCad 7
Browse files Browse the repository at this point in the history
Fixes #466
  • Loading branch information
set-soft committed Jul 21, 2023
1 parent 6f8586e commit 7ff3556
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.6.4] - UNRELEASED
### Fixed
- Rotated polygons used in the worksheet (#466)
- Rotated polygons and text used in the worksheet (#466)

## [1.6.3] - 2023-06-26
### Added
Expand Down
6 changes: 6 additions & 0 deletions kibot/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ def p2v_k7(point):
return pcbnew.VECTOR2I(point)
return point

def angle(ang):
if hasattr(pcbnew, 'EDA_ANGLE'):
# Here we can't use KiCad version because the nasty pcb_transition can be patching it
return pcbnew.EDA_ANGLE(ang*10, pcbnew.TENTHS_OF_A_DEGREE_T)
return ang*10

@staticmethod
def get_modules():
if GS.ki6:
Expand Down
4 changes: 2 additions & 2 deletions kibot/kicad/worksheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def draw(e, p):
if e.font.italic:
s.SetItalic(True)
if e.rotate:
s.SetTextAngle(e.rotate*10)
s.SetTextAngle(GS.angle(e.rotate))
# Adjust the text size to the maximum allowed
if e.max_len > 0:
w = s.GetBoundingBox().GetWidth()
Expand Down Expand Up @@ -381,7 +381,7 @@ def draw(e, p):
s.SetWidth(e.line_width)
s.SetLayer(p.layer)
if e.rotate:
s.Rotate(GS.p2v_k7(pos), e.rotate*10)
s.Rotate(GS.p2v_k7(pos), GS.angle(e.rotate))
p.board.Add(s)
p.pcb_items.append(s)
pos += posi
Expand Down

0 comments on commit 7ff3556

Please sign in to comment.