Skip to content

Wrong orientation of apertures when rendering to svg #242

@marekpechal

Description

@marekpechal

Describe the bug

When rendering a simple gerber with rectangular pads as svg, the orientation of the pads is wrong.

To Reproduce

Steps to reproduce the behavior:

  1. Run the following with this example.gbr file
    from pygerber.gerberx3.api.v2 import GerberFile
    gf = GerberFile.from_file('example.gbr').parse()
    gf.render_svg("output.svg")

  2. You will get the output below

output

Expected behavior
The gerber file (here opened in the gerber viewer bundled with KiCad 8.0) should actually look like this:
example_kicad-gbr-viewer

Desktop:

  • OS: Windows 10
  • Python version: 3.12.4
  • PyGerber version: 2.4.0

Additional context

I suspect this is due to gerber specifying rotation angles counterclockwise while svg uses a clockwise angle convention. I managed to fix the issue in this particular case by adding a minus sign here. There may be similar issues with other graphical primitives which I have not checked.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions