INTI-CMNB / KiBot

KiCad automation utility
GNU Affero General Public License v3.0
556 stars 66 forks source link

[FEATURE] Human readable CSV BOM #334

Closed Unichord closed 1 year ago

Unichord commented 1 year ago

I couldn't find a switch to add tabs in addition to commas to a CSV BOM using the internal BOM generator, in order to have values neatly put into columns and therefore make the BOM human readable. I know I can use other formats, I'd just find convenient not to generate XLSX just for reading it.

Here is a small example of what I mean:

Row,Part,References,Value,Footprint,Quantity Per PCB,
1,C,C4 C6 C10 C11 C12 C13 C14,100n,C_0603,7,
2,CP,C8 C9,10u,C_1206P,2,
3,CP,C2 C3,220u,C_8.0mm,2,
Row, Part,                References, Value, Footprint, Quantity Per PCB,
  1,    C, C4 C6 C10 C11 C12 C13 C14,  100n,    C_0603,                7,
  2,   CP,                     C8 C9,   10u,   C_1206P,                2,
  3,   CP,                     C2 C3,  220u,   C_8.0mm,                2,

Is it there but I just can't find it? Is it doable? Are there any downsides to it?

set-soft commented 1 year ago

Hi @Unichord ! You can try using the TXT or TSV formats. They use tab as separator. Also: you can specify a separator in the csv section. The drawback is that you'll need a big tab width, making the columns too separated.

Unichord commented 1 year ago

Hi @set-soft, thanks for the answer. separator requires 1 character, as far as I can tell, so '\t' doesn't work for example, neither do multiple symbols. I tried using TSV, but it does not align columns, just puts a tab between each value. Which is fine, it's its function.

At the moment I'm using a N++ plugin to align columns.

set-soft commented 1 year ago

Hi @Unichord ! I added a new format: HRTXT It generated:

|Row               |Description                                                                                                |Part                |References                                  |Value               |Footprint                                                   |Quantity Per PCB|Status|Datasheet                                                                                  |LCSC#  |MFR                                    |MPN                               |
|------------------|-----------------------------------------------------------------------------------------------------------|--------------------|--------------------------------------------|--------------------|------------------------------------------------------------|----------------|------|-------------------------------------------------------------------------------------------|-------|---------------------------------------|----------------------------------|
|1                 |Unpolarized capacitor                                                                                      |C                   |C2 C8                                       |0.1uF               |R_0402_1005Metric                                           |2               |      |~                                                                                          |C1525  |Samsung Electro-Mechanics              |CL05B104KO5NNNC                   |
|2                 |Unpolarized capacitor                                                                                      |C                   |C1                                          |1uF                 |R_0402_1005Metric                                           |1               |      |~                                                                                          |C52923 |Samsung Electro-Mechanics              |CL05A105KA5NQNC                   |
|3                 |Unpolarized capacitor                                                                                      |C                   |C4                                          |1uF                 |R_0603_1608Metric                                           |1               |      |~                                                                                          |C15849 |Samsung Electro-Mechanics              |CL10A105KB8NNNC                   |
|4                 |Unpolarized capacitor                                                                                      |C                   |C3                                          |4.7uF               |R_0603_1608Metric                                           |1               |      |~                                                                                          |C19666 |Samsung Electro-Mechanics              |CL10A475KO8NNNC                   |
|5                 |Unpolarized capacitor                                                                                      |C                   |C6                                          |4.7uF               |R_0402_1005Metric                                           |1               |      |~                                                                                          |C23733 |Samsung Electro-Mechanics              |CL05A475MP5NRNC                   |
|6                 |Unpolarized capacitor                                                                                      |C                   |C7                                          |10uF                |R_0402_1005Metric                                           |1               |      |~                                                                                          |C15525 |Samsung Electro-Mechanics              |CL05A106MQ5NUNC                   |
|7                 |Unpolarized capacitor                                                                                      |C                   |C5                                          |22uF                |R_0603_1608Metric                                           |1               |      |~                                                                                          |C59461 |Samsung Electro-Mechanics              |CL10A226MQ8NRNC                   |
|8                 |Schottky diode                                                                                             |D_Schottky          |D1 D2 D3 D4 D5 D6 D7 D8 D9 D10              |D_Schottky          |D_SOD-123                                                   |10              |      |~                                                                                          |C8598  |Changjiang Electronics Tech (CJ)       |B5819W SL                         |
|9                 |Light emitting diode, small symbol                                                                         |LED_Small           |D11 D12                                     |Green               |LED_0603_1608Metric                                         |2               |      |~                                                                                          |C72043 |Everlight Elec                         |19-217/GHC-YR1S2/3T               |
|10                |Light emitting diode, small symbol                                                                         |LED_Small           |D13 D14                                     |Red                 |LED_0603_1608Metric                                         |2               |      |~                                                                                          |C2286  |                                       |                                  |
|11                |Generic connector, single row, 01x03, script generated (kicad-library-utils/schlib/autogen/connector/)     |Conn_01x03          |J12                                         |Conn_01x03          |JST_XH_B3B-XH-A_1x03_P2.50mm_Vertical                       |1               |      |~                                                                                          |       |                                       |                                  |
|12                |Generic screw terminal, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)|Screw_Terminal_01x02|J1 J3 J4 J5 J6 J7 J8 J9 J10 J11             |Screw_Terminal_01x02|TerminalBlock_Phoenix_PT-1,5-2-3.5-H_1x02_P3.50mm_Horizontal|10              |      |~                                                                                          |       |                                       |                                  |
|13                |USB Micro Type B connector                                                                                 |USB_B_Micro         |J2                                          |USB_B_Micro         |USB_Micro-B_Molex-105017-0001                               |1               |      |~                                                                                          |       |                                       |                                  |
|14                |N-MOSFET transistor, gate/source/drain                                                                     |Q_NMOS_GSD          |Q4 Q5 Q6 Q7 Q8 Q9 Q10                       |Q_NMOS_GDS          |SOT-23                                                      |7               |      |~                                                                                          |C20917 |Alpha & Omega Semico                   |AO3400A                           |
|15                |N-MOSFET transistor, gate/source/drain                                                                     |Q_NMOS_GSD          |Q3                                          |Q_NMOS_GSD          |SOT-23                                                      |1               |      |~                                                                                          |C20917 |Alpha & Omega Semico                   |AO3400A                           |
|16                |NPN transistor, base/emitter/collector                                                                     |Q_NPN_BEC           |Q1 Q2                                       |Q_NPN_BEC           |SOT-23                                                      |2               |      |~                                                                                          |C2150  |Changjiang Electronics Tech (CJ)       |SS8050                            |
|17                |Resistor                                                                                                   |R                   |R12 R13                                     |47R                 |R_0402_1005Metric                                           |2               |      |~                                                                                          |C25118 |Everlight Elec UNI-ROYAL(Uniroyal Elec)|19-217/GHC-YR1S2/3T 0402WGF470JTCE|
|18                |Resistor                                                                                                   |R                   |R4 R5 R6 R7 R8 R9 R10 R11                   |100R                |R_0402_1005Metric                                           |8               |      |~                                                                                          |C25076 |UNI-ROYAL(Uniroyal Elec)               |0402WGF1000TCE                    |
|19                |Resistor                                                                                                   |R                   |R14 R15                                     |150R                |R_0402_1005Metric                                           |2               |      |~                                                                                          |C25082 |UNI-ROYAL(Uniroyal Elec)               |0402WGF1500TCE                    |
|20                |Resistor                                                                                                   |R                   |R1 R2 R3 R16 R17 R18 R19 R20 R21 R22 R23 R24|10kR                |R_0402_1005Metric                                           |12              |      |~                                                                                          |C25744 |UNI-ROYAL(Uniroyal Elec)               |0402WGF1002TCE                    |
|21                |Push button switch, generic, two pins                                                                      |SW_Push             |SW1                                         |SW_Push             |TS-1187A                                                    |1               |      |~                                                                                          |C318888|XKB Connectivity                       |TS-1187A-C-D-B                    |
|22                |1A 20V Fixed LDO Linear Regulator, 3.3V, SOT-89/SOT-223/TO-220/TO-252/TO-263                               |AZ1117-3.3          |U1                                          |AZ1117-3.3          |SOT-223-3_TabPin2                                           |1               |      |https://www.diodes.com/assets/Datasheets/AZ1117.pdf                                        |C92102 |Diodes Incorporated                    |AZ1117CH-3.3TRG1                  |
|23                |Single-Chip USB-to-UART Bridge, USB 2.0 Full-Speed, 2Mbps UART, QFN package                                |CP2104              |U2                                          |CP2104              |QFN-24-1EP_4x4mm_P0.5mm_EP2.6x2.6mm                         |1               |      |https://www.silabs.com/documents/public/data-sheets/cp2104.pdf                             |C47742 |SILICON LABS                           |CP2104-F03-GMR                    |
|24                |Temperature and humidity module                                                                            |DHT11               |U4                                          |DHT11               |Aosong_DHT11_5.5x12.0_P2.54mm                               |1               |      |http://akizukidenshi.com/download/ds/aosong/DHT11.pdf                                      |       |                                       |                                  |
|25                |RF Module, ESP32-D0WDQ6 SoC, Wi-Fi 802.11b/g/n, Bluetooth, BLE, 32-bit, 2.7-3.6V, onboard antenna, SMD     |ESP32-WROOM-32      |U3                                          |ESP32-WROOM-32      |ESP32-WROOM-32                                              |1               |      |https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf|       |                                       |                                  |
|------------------|-----------------------------------------------------------------------------------------------------------|--------------------|--------------------------------------------|--------------------|------------------------------------------------------------|----------------|------|-------------------------------------------------------------------------------------------|-------|---------------------------------------|----------------------------------|

|Project info:     |
|------------------|
|Schematic:        |light_control                                                                                              |
|Variant:          |default                                                                                                    |
|Revision:         |                                                                                                           |
|Date:             |2022-08-23_14-07-22                                                                                        |
|KiCad Version:    |6.0.9+dfsg-1~bpo11+1                                                                                       |
|------------------|-----------------------------------------------------------------------------------------------------------|
|Statistics:       |
|------------------|
|Component Groups: |25                                                                                                         |
|Component Count:  |73                                                                                                         |
|Fitted Components:|73                                                                                                         |
|Number of PCBs:   |1                                                                                                          |
|Total Components: |73                                                                                                         |
|------------------|-----------------------------------------------------------------------------------------------------------|

Which is quite readable, please let me know if it works for you

Unichord commented 1 year ago

That's awesome, thanks! So using hrtxt with comma separator would be possible, right?

set-soft commented 1 year ago

That's awesome, thanks! So using hrtxt with comma separator would be possible, right?

Yes