tracespace / gerber-to-svg

gerber-to-svg development moved to tracespace/tracespace
https://github.com/tracespace/tracespace
MIT License
81 stars 20 forks source link

gerber-to-svg throws exception & stops parsing on tools with bad parameters #11

Closed TheunisKotze closed 9 years ago

TheunisKotze commented 9 years ago

I have many gerbers that cause gerber-to-svg to throw 'rect height out of range (0<=0)'. The rest of the file is fine though, so I think it's better to ignore these tools and continue parsing? Currently just catching the exception here - https://github.com/circuithub/gerber-to-svg/commit/18a2ed32e0be20e06f69c30317461343e3daaefa in order to continue parsing the gerber, but perhaps a list of encountered errors could be returned post parse/plot. What do you think?

mcous commented 9 years ago

I had never seen that before. Priority is definitely to draw something, so that throw could probably be downgraded to a console.warn. Technically only zero-size circles are allowed by the Gerber spec, but I'd rather create a zero size rectangle tool than ignore it completely. Is the tool being used for flashes, regions, or both? Attach any relevant parts of the gerber, if you can.

mcous commented 9 years ago

Any chance I can a look at one of those gerbers with a 0 size rectangle?

mcous commented 9 years ago

I pushed a change that will allow zero-size rectangles, but throw a warning to console.warn (or the warning array) and convert the tool to a circle.

It'll still throw for negative side-length, so if those gerbers were throwing for that reason, then I don't really know. If that's what's happening, or you see other zero-size aperture shapes (obround, polygon), then we can reopen the issue.