Skip to content

fix: Close unclosed contours#578

Merged
eyal0 merged 1 commit intopcb2gcode:masterfrom
eyal0:unclosed_contour
Apr 11, 2021
Merged

fix: Close unclosed contours#578
eyal0 merged 1 commit intopcb2gcode:masterfrom
eyal0:unclosed_contour

Conversation

@eyal0
Copy link
Copy Markdown
Contributor

@eyal0 eyal0 commented Apr 11, 2021

According to the Gerber Format
Specification

section 4.6.1, a contour may only be ended by a D02 or G37 when the
contour is closed. For example, a rectangle must have four line
segments, not three.

EasyEDA seems to be making shapes missing a line segment and assumes
that interpreters will close the contour. pcb2gcode can support
this by checking that the region is closed. If not, add a point at
the end which matches the first point so that the contour is closed.

This fixes #577

According to the [Gerber Format Specification](https://www.bosco.co.za/DownloadDocs/The_Gerber_Format_Specification.pdf) section 4.6.1, a contour may only be ended by a D02 or G37 when the contour is closed.  For example, a rectangle must have four line segments, not three.

EasyEDA seems to be making shapes missing a line segment and assumes that interpreters will close the contour.  `pcb2gcode` can support this by checking that the region is closed.  If not, add a point at the end which matches the first point so that the contour is closed.

This fixes pcb2gcode#577
@eyal0 eyal0 force-pushed the unclosed_contour branch from 575a7c9 to 5e8e6f8 Compare April 11, 2021 03:50
@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Status

Coverage increased (+0.007%) to 69.251% when pulling 5e8e6f8 on eyal0:unclosed_contour into b3f55dd on pcb2gcode:master.

@eyal0 eyal0 merged commit 6a84c25 into pcb2gcode:master Apr 11, 2021
@eyal0 eyal0 deleted the unclosed_contour branch April 11, 2021 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Converting some easyeda gerbers causing "Internal error in gerberimporter" and crash

2 participants