INTI-CMNB / KiBot

KiCad automation utility
GNU Affero General Public License v3.0
552 stars 65 forks source link

[HOW] How to have a DNP/DNF column in csv/xlsx/html BOMs #602

Closed schneider-engineering closed 5 months ago

schneider-engineering commented 5 months ago

What do you want to achieve? We would like to generate BOMs with DNP columns like this:

Qty References Footprint Value DNP
5 C5 C7 C9 C18 C20 C_0402_1005Metric 0.1µ 16V
1 C6 C_0402_1005Metric 0.1µ 16V DNP

The html variant with the additional, separate table and the xlsx DNF worksheet are nice and known, but not what we are looking for. For the CSV variant we do not know of any way to include components marked as DNP in the BOM.

Is this possible with KiBot?

Do you have some configuration file (.kibot.yaml) that you are using? You can attach it or paste the content in the following section:

- name: 'bom_xlsx'
    comment: "Spreadsheet for the Bill of Materials"
    type: bom
    dir: bom
    options: &bom_options
      xlsx:
        title: '%p'
        logo: false
        digikey_link: Digikey
        highlight_empty: false
      columns:
        - Row
        - field: Quantity Per PCB
          name: Qty
        - References
        - Footprint
        - Value
        - Spec
        - Manufacturer
        - MPN
        - Description
        - Digikey
        - Notes

  - name: 'bom_html'
    comment: "HTML for the Bill of Materials"
    type: bom
    dir: bom
    options:
      <<: *bom_options
      format: HTML
      html:
        title: '%p'
        logo: false
        digikey_link: Digikey
        highlight_empty: false

  - name: 'bom_csv'
    comment: "CSV for the Bill of Materials"
    type: bom
    dir: bom
    options:
      <<: *bom_options
      format: CSV
      csv:
        hide_pcb_info: true
        hide_stats_info: true

Environment (please complete the following information): ghcr.io/inti-cmnb/kicad8_auto_full:1.6.5 in gitlab ci

set-soft commented 5 months ago

The column for the "DNP" is Status, you need to add it, you can rename also it. To get the DNP components in the same list use: ignore_dnf: true To avoid a separated list of DNPs use generate_dnf: false For HTML something like this:

  - name: 'bom_xlsx'
    comment: "Spreadsheet for the Bill of Materials"
    type: bom
    dir: bom
    options: &bom_options
      xlsx:
        title: '%p'
        logo: false
        digikey_link: Digikey
        highlight_empty: false
      columns:
        - Row
        - field: Quantity Per PCB
          name: Qty
        - References
        - Footprint
        - Value
        - Spec
        - Manufacturer
        - MPN
        - Description
        - Digikey
        - Notes
        - Status

  - name: 'bom_html'
    comment: "HTML for the Bill of Materials"
    type: bom
    dir: bom
    options:
      <<: *bom_options
      ignore_dnf: true
      format: HTML
      html:
        title: '%p'
        logo: false
        digikey_link: Digikey
        generate_dnf: false
        highlight_empty: false
schneider-engineering commented 5 months ago

Thank you very much for the quick answer. That just does the job. Is this documented somewhere? I tried to find this, but even when knowing how to do it, I can't find this.

Is there any way to change the resulting (DNF) into something else? like e.g. DNP? The source suggests to me this is hardcoded, but my understanding of filters is not good enough.

set-soft commented 5 months ago

Thank you very much for the quick answer. That just does the job. Is this documented somewhere? I tried to find this, but even when knowing how to do it, I can't find this.

Is used in various examples, but you are right, weren't formally documented. The above mentioned patch solves it.

Is there any way to change the resulting (DNF) into something else? like e.g. DNP? The source suggests to me this is hardcoded, but my understanding of filters is not good enough.

If you need to customize it I'll suggest to use Footprint Populate column, whose values can be configured using footprint_populate_values.