wireviz / WireViz

Easily document cables and wiring harnesses.
GNU General Public License v3.0
4.42k stars 225 forks source link

[feature] Include BOM table in graphical output #227

Open formatc1702 opened 3 years ago

formatc1702 commented 3 years ago

GraphViz allows HTML tables in a graph's label:

graph {
    graph [bgcolor=white fontname=arial label=<<table border="0" cellspacing="0" cellpadding="3" cellborder="1"><tr><td>A</td><td>B</td></tr><tr><td>C</td><td>D</td></tr></table>>]

// etc.
}
image

This could be used to optionally include the complete BOM table inside the graphical output (PNG/SVG) if desired, and would especially be useful when wanting the graphics to include all information about the harness (including additional BOM items otherwise not visible), as well as when , as proposed in #224, using show_part_numbers set to False to keep the connector and cable nodes compact, and using BOM item numbers to cross-reference with the BOM table that does show all part number info.

An additional use could be a simplified title block, showing basic metadata such as a title and description. This could appear as part of the BOM table, or -by using a blank row with no border- made to look like a separate table.

kvid commented 3 years ago

Such a new graph element is easy to test with my PR #215 together with e.g. this input:

connectors:
  X1:
    pincount: 4
  X2:
    pincount: 4
cables:
  W1:
    wirecount: 4
    color_code: DIN
connections:
  - - X1: [1-4]
    - W1: [1-4]
    - X2: [1-4]
tweak:
  append: |-
    graph [bgcolor=white fontname=arial label=<<table border="0" cellspacing="0" cellpadding="3" cellborder="1"><tr><td>AAAAAAAAAAAAAAAAAAAAAAAA</td><td>BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</td></tr><tr><td>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</td><td>DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD</td></tr></table>>]

Update: PR #215 was merged into the main branch in 2021 and is included in releases from v0.3.