yaqwsx / PcbDraw

Convert your KiCAD board into a nicely looking 2D drawing suitable for pinout diagrams
MIT License
1.13k stars 90 forks source link

Add support for THT Resistor Color Code Markings #78

Closed Electro707 closed 2 years ago

Electro707 commented 2 years ago

Related to https://github.com/yaqwsx/PcbDraw-Lib/pull/19, this PR allows PcbDraw to, if the component it's drawing is a THT resistor, to auto-detect the resistor value and change the band's color to reflect that: image

The resistor's values can also be set manually with the resistor-values argument, input given as comma delimited key-value pairs that are colon delimited, for example resistor-values R1:1k,R2:20k.

The colors of the bands are in the default board style. If a board style doesn't have this (or any keys), it will get copied from the default style.

Closes https://github.com/yaqwsx/PcbDraw/issues/71

TODO:

Electro707 commented 2 years ago

Removing the WIP tag as most of what needs to be done should be up for discussion.

yaqwsx commented 2 years ago

Thank you for your effort! Here are my thoughts on the topics:

I also have one suggestion: Currently, you use opacity to disable the bands. I was thinking of using display="none" instead. It is easier to see and we could implement bands that are semi-opaque. Also, I guess display="none" might be more efficient on rendering. What are your thoughts?

Electro707 commented 2 years ago

If a CLI rework is already in the plans, then having it as a direct argument instead of a file is fine.

I do like the idea of changing the display property instead of opacity, so I changed that in e01e3b0 and the component library.

yaqwsx commented 2 years ago

Hi, do you plan to incorporate any changes? If not, I will give the code final proof-reading and testing and we could merge this!

Electro707 commented 2 years ago

I don't see any more changes that can be added

yaqwsx commented 2 years ago

Looks good to me. Could you rebase is to master? Then I will merge this.

Electro707 commented 2 years ago

Rebased to master, also updated the footprint library to point to master of pcbdraw-lib