diff --git a/CHANGELOG.md b/CHANGELOG.md index 210ea9d7b..262639584 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/kibot/gs.py b/kibot/gs.py index f24c515f8..6ec59bd4e 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -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: diff --git a/kibot/kicad/worksheet.py b/kibot/kicad/worksheet.py index be5ad3b41..5dae2f3d3 100644 --- a/kibot/kicad/worksheet.py +++ b/kibot/kicad/worksheet.py @@ -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() @@ -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