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

Allow custom drill decimal format #10

Closed TheunisKotze closed 9 years ago

TheunisKotze commented 9 years ago

In altium you can specify a whole range of different formats (eg 4:4) for export, and the default does not seem to be the same as excellon's default. Here I allow the format to be passed in via the options. Not sure if you'd like to handle this in another way? Another/additional option: Altium includes a comment that contains the format in the file, here's a branch that extracts it from the comments if it's present - https://github.com/circuithub/gerber-to-svg/tree/feat/parse-drill-format

mcous commented 9 years ago

I like this idea, although parser options should be passed in with an opts object. That object could have keys for zero format as well as units, since those are both often left unspecified. Additionally, both the drill parser and the gerber parser should probably be inheriting from a parent parser class that can take in an options object for units and places, parse that, and set the class attributes accordingly.

Would you rather I close this PR and have those changes in a new request, or refactor this one?

I really like the comment parsing idea, and I can imagine a drill comment parser that can pull stuff like units, zero-format, etc out of the comments of drill files from the various big CAD packages (e.g. Altium, Mentor, Eagle, KiCAD, etc.). Thoughts?

TheunisKotze commented 9 years ago

I can take a stab at adding in those changes here, doesn't really matter to me. Another problem I've run into is having kicad export drill files in imperial & corresponding gerbers in metric. This creates some trouble when trying to use those together.. Need to think about that case a bit more though..

A more general comment parser sounds good, I'll take a look at what some other tools do when I have a chance.

mcous commented 9 years ago

Good stuff.

I think unit mismatch would be more of a user issue / problem for anything that's combining the layers into one image. Unit conversion could be possible with this library, but I'm inclined to say it's outside of the scope; if a person is generating manufacturing files for a board with mismatched units, they should adjust their workflow. (I'm a pretty heavy KiCad user, and it'll export whatever you tell it to.)

mcous commented 9 years ago

Also, if you do make any changes in this branch, please make sure you rebase with the latest master. I've pushed some big changes with how coordinates are handled to deal with a SVG bug in Firefox.

On that note, it was cool to see this library being used in the wild on CircuitHub (though a shoutout in the blog would've been nice...), but that Firefox bug is pretty bad (checkout the board view for https://circuithub.com/projects/andrew/LilyPad_Arduino_USB in Firefox). I'd recommend updating your backend to v0.2.2. It'll also require a slight board-builder change that you can see in the latest svgerber code.

mcous commented 9 years ago

0745961 adds the features discussed in this PR, so I'm closing it. I've spun off discussion for parsing drill file comments to #16.