wireviz / WireViz

Easily document cables and wiring harnesses.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature] Single wire cable drawn without table

martinrieder opened this issue · comments

The following example brings up an interesting (and quite common?) use case for cables containing only a single wire. Similar to the way that connectors can be defined with style: simple, I suggest to implement cables with this attribute. They would be displayed without a box and should optionally show the wire name/label.

Credits to @EloiVilalta in #293 (comment)

connectors:
  C1:
    style: simple
    type: Connector
  C2:
    style: simple
    type: Connector      
cables:  
  W1:
    wirecount: 1
    show_name: false
    show_wirecount: false
    colors: [RD]

connections:
  -
    - C1: [1]
    - W1: [1]
    - C2: [1]

The issue with the current implementation is that it requires a lot of space in the graph due to the HTML table. This is not needed for only displaying the label/name as a text.

image

This would allow for the same principle as virtual splices to be applied to wires instead of connectors. It enables simplified layouts and possibly also grouping of wires into clusters. The latter enforces some structure, but leaves the order of the wires up to the Graphviz engine.

@kvid in #270 (comment)

When I use the term virtual splice, I mean a connection between two matching wires in WireViz that in real life represents a continuation of the same wire (no physical cut) and visualized in the diagram as such.

This suggestion also complements #268 (comment), which refers to an example provided by @Halfwalker, who called this feature compact_view.

image

Similar arrangements should be produced for wires being grouped into a cluster. Splicing a wire in a similar fashion should also be possible.

@kvid I noticed that you discussed some similar idea with @formatc1702 a few years back in #31. Do you have any updates on the topic?

Another thing that might help, is to combine all invisible nodes on the same rank inside a sheathing into a common invisible node to avoid that Graphviz swap their order.

Taking the picture by @SnowMB as an example from this:

You can use rank=same to clean up node placement.

graph(2)

commented

See also #225 (comment) where @formatc1702 strongly considers consolidating the optional style attribute into category that already exists for both connectors and cables.

Maybe this issue is an extra argument for such a consolidation?

I like the idea of consolidating. If connector type: would not already be in use, I would suggest to use this instead of category: for both cables and connectors.

commented

@martinrieder wrote:

I like the idea of consolidating. If connector type: would not already be in use, I would suggest to use this instead of category: for both cables and connectors.

When consolidating, we might end up with allowing more than one value for the same connector/cable, and if so, then flags or class might be alternative names? I suggest we try collecting different values that might be useful in a consolidated attribute, and see if they are mutually exclusive or not.

I went through the list of Graphviz attributes and found that class is used in the context of stylesheets, so it might be reserved for also implementing these in WireViz.

I cannot think of an example for flags, which implies multiple settings being combined... What about model?

commented

Maybe just stick with category for now? It's perfectly legal to be member of more than one category if needed.

Okay, what is the default category called then? Would it be defined as sheathed, generic or simply leave it undefined?

I suggest the following categories

  1. Single conductor
  2. Wire pairs
    • twisted
    • coaxial
  3. Multi-core
    • sheathed/generic
    • bundle

Twisted pairs could have either sheathing and/or shielding. Coaxial cable would normally have both. Even single wires are sometimes shielded, though this comes close to the definition of a coaxial cable then.

Please also see #353 (comment) where I suggested a category for twisted pairs.
There is also a quite detailed discussion about different cable properties in #56...

My intention with this issue is only to add some way to display simple cables with a single conductor/wire. You may therefore consider my question above only hypothetical. ;-)

For this kind of cable, wire count and number are implicitly hidden. In the same way, I would omit the color label by default. Having it explicitly displayed would require adding show_color to the syntax. If there is no wirelabel defined, then no text would be displayed at all.

In #155 (comment), I suggested adding connectorlabel, but I realize that maybe cablelabel might be needed as well. In case of a single wire, this would be equal to the wirelabel, of course.

EDIT: also compare #286 (comment)

After what I wrote in #331 (comment), I decided to use the term wire instead of conductor for the single-core cable.

See also #225 (comment) where @formatc1702 strongly considers consolidating the optional style attribute into category that already exists for both connectors and cables.

Maybe this issue is an extra argument for such a consolidation?

In my PR #405, I decided to first implement both, so style: simple and category: wire will be synonymous. One of them will be dropped later.