[Fixed] Rotated text in worksheet for KiCad 7

Fixes #466
This commit is contained in:
Salvador E. Tropea 2023-07-21 19:43:21 -03:00
parent 6f8586e8cb
commit 7ff35563e6
3 changed files with 9 additions and 3 deletions

View File

@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.6.4] - UNRELEASED ## [1.6.4] - UNRELEASED
### Fixed ### Fixed
- Rotated polygons used in the worksheet (#466) - Rotated polygons and text used in the worksheet (#466)
## [1.6.3] - 2023-06-26 ## [1.6.3] - 2023-06-26
### Added ### Added

View File

@ -299,6 +299,12 @@ class GS(object):
return pcbnew.VECTOR2I(point) return pcbnew.VECTOR2I(point)
return 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 @staticmethod
def get_modules(): def get_modules():
if GS.ki6: if GS.ki6:

View File

@ -315,7 +315,7 @@ class WksText(WksDrawing):
if e.font.italic: if e.font.italic:
s.SetItalic(True) s.SetItalic(True)
if e.rotate: if e.rotate:
s.SetTextAngle(e.rotate*10) s.SetTextAngle(GS.angle(e.rotate))
# Adjust the text size to the maximum allowed # Adjust the text size to the maximum allowed
if e.max_len > 0: if e.max_len > 0:
w = s.GetBoundingBox().GetWidth() w = s.GetBoundingBox().GetWidth()
@ -381,7 +381,7 @@ class WksPolygon(WksDrawing):
s.SetWidth(e.line_width) s.SetWidth(e.line_width)
s.SetLayer(p.layer) s.SetLayer(p.layer)
if e.rotate: 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.board.Add(s)
p.pcb_items.append(s) p.pcb_items.append(s)
pos += posi pos += posi