Skip to content

[PyGerber]: Macro elements come out upside down in SVG render #371

@Trackmaniadude

Description

@Trackmaniadude

PyGerber Bug Report

Mandatory checks

Before opening this issue:

  • I have reviewed the README for guidelines and haven't found a solution there.
  • I have reviewed the PyGerber documentation and haven't found a solution there.
  • I have reviewed the existing open issues and verified that this is not a
    duplicate.
  • I have reviewed the existing closed issues and verified that this was already
    resolved or marked as won't fix.
  • I have reviewed the existing pull requests and verified that this is not a already
    known issue.
  • I have reviewed the existing discussions and verified that this is not a already
    known issue.

#242

To Reproduce

Run below code with errtest-F_Paste.txt (note, wouldn't let me upload .gbr so I changed it to a .txt, just change it back)

from pygerber.gerberx3.api.v2 import GerberFile
GerberFile.from_file('errtest-F_Paste.gbr').parse().render_svg("output.svg")

Should result in

Image
(Note: rounded rectangle macros generated by KiCad, not normal rectangles)

Expected behavior

Image should be this (from KiCad gerber viewer)

Image

Also, output from raster renderer

Image

Additional context

Initially thought the issue was inverted rotation, like with the rectangle issue, however it became clear its y axis inversion when looking at asymmetric elements (unfortunately I couldn't figure out how to make an original test file with such elements). I poked around trying to fix it myself for a bit, and I think the issue is somewhere around render_flash_macro in renderer2/svg.py. Changing flip_y=False (668 svg.py) to True sort of fixed the issue, but affected elements were misplaced vertically.

Environment:

Please complete the following information:

  • Operating system: Windows 10
  • Python version: 3.11.0
  • PyGerber version: 2.4.2

Optional checks

  • I want to contribute example source files attached to this issue in the test suite
    of PyGerber for regression testing purposes.
  • I want to include separate LICENSE file for resource files attached as a result of
    an agreement described in first checkbox in this section.
  • I want to include separate README file for resource files attached as a result of
    an agreement described in first checkbox in this section.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is neededmaintenanceIssue related to maintenance of PyGerber project

Projects

Status

Stalled

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions