WireViz icon indicating copy to clipboard operation
WireViz copied to clipboard

[feature] Adding banded multicolor wires

Open SnowMB opened this issue 5 years ago • 20 comments

Splitting out from #96 as requested:

I'm looking for a way to produce a banded output for two color wires. #96 introduced two colors by showing the second color as stripe along the wire.

I think with a banded representation it is easier to distinguish the colors and looks more visually appealing.

Here is an example (taken from #96):

image

I've just play around with the .gv files and the dot language.

Todo:

  • [ ] Styling the representation in the Wire- Node (should be easy to do)
  • [ ] Finding a way to make the size of the color bands consistent. In my example every wire has exactly 10 bands (10% of the edge per band) which results in longer bands when the wire gets longer. Maybe using style="dashed" can be used. But I think it's not as visually appealing as the example above.
  • [ ] Making sure that the way I got graphviz to draw multiple edges on top of each other is actually working as intended and not just a bug in my version of graphviz dot - graphviz version 2.44.0 (0) which might be fixed later
  • [ ] Integration into the WireViz python scripts

SnowMB avatar Jul 20 '20 11:07 SnowMB

Cables will probably require a new attribute to specify what style the user wants:

multicolor: lengthwise  # current look
multicolor: rings       # proposed new look

Since ethernet cables, for example, are striped lengthwise, whereas DIN 47100 specifies rings.

This raises another question, whether the colors should be split 50/50, or whether the second color defines thin rings over a base color? The wires I have lying around here have around a 3/1 ratio of base to rings, the following picture has around 2/1 ratio.

image

17o2 avatar Jul 20 '20 12:07 17o2

This raises another question, whether the colors should be split 50/50, or whether the second color defines thin rings over a base color? The wires I have lying around here have around a 3/1 ratio of base to rings, the following picture has around 2/1 ratio.

Arbitrary ratios are possible. But the yaml might grow very verbose if everything has to be specified. Maybe use 50/50 as starting point and add arbitrary values later if someone needs them? I think for the documentation purpose it might not be so important to exactly match the wire :smile:

In the mean time I also encountered 3 color wires, which also should be possible.

SnowMB avatar Jul 20 '20 13:07 SnowMB

Are there any thoughts on how to actually implement this? I assume we'd lose the outlines on the wires, as I didn't see any way to actually pattern the lines/paths in graphviz. Ideally, this could be done wiht a primary/secondary/(possibly tertiary) color, with the dashed connectors, but that didn't seem to be an attribute that could be specified.

Also, as a side note: there are different styles of banding, such as diagonal stripes instead of vertical stripes, though those are usually seen in UTP/STP cables.

aakatz3 avatar Jul 20 '20 14:07 aakatz3

Are there any thoughts on how to actually implement this?

Ideally there would be a way to layout the graph and ask graphviz how long the edges are, than fractions for the coloring could be computed and the graph could be redrawn with colors. Otherwise I am not sure yet. With a solid color and a style="dashed" edge on top we can achieve 2 colors but not more. Maybe using solid for color 1, dashed for color 2 and dotted for color 3? I have to check how this looks. :thinking:

I assume we'd lose the outlines on the wires

If we can reliably draw multiple edges on top of each other you can draw a wider black edge in the backround and the colors on top like my example, so this would not be an issue.

Also, as a side note: there are different styles of banding, such as diagonal stripes instead of vertical stripes, though those are usually seen in UTP/STP cables.

I don't think, that there are actually diagonal bands. For me it looks more like a twisted stripe. :stuck_out_tongue_closed_eyes:

SnowMB avatar Jul 20 '20 16:07 SnowMB

So playing with the table for the wire I got some banded rendering inside the wire node and can match the dimension of the edge with a little bit trial and error. This also got me thinking of possibilities to improve the rendering of the existing multicolor stripe method. (instead of rendering 3 distinct wires for singlecolor to match multicolor width just play around with penwidth attribute of edges and height attribute of the table rows. I also would use the border attribute instead of drawing extra table rows for top and bottom borders.

ex10_with_table gv

For the time being I think in this particular case the differences in wire length and resulting band width are still ok. But I can see that mixing very long with very short wires can look ugly. I will start digging into the python scripts the next days to make a test implementation with the existing limitations so that you can try it out.

SnowMB avatar Jul 20 '20 20:07 SnowMB

How would your striped wires look if you made them the same thickness as the current single-color ones (see example gallery)?

I added in a feature that pads single-color wires to match the thickness of the current lengthwise striped ones, but only if there are any multicolor wires present at all, since I find the thinner style more appealing.

Could you attach a new render?

17o2 avatar Jul 21 '20 20:07 17o2

Sure this is an easy to change detail :smile:

Here you go:

graph(1)

SnowMB avatar Jul 22 '20 08:07 SnowMB

This raises another question, whether the colors should be split 50/50, or whether the second color defines thin rings over a base color?

Both styles are in use. Banded coloring may be 50/50 or may be unequal to differentiate "major" versus "minor" colors on each wire.

In the 25-pair code, for instance, each wire has a major and minor color, and it is paired with another wire that has the same two colors but flipped in dominance. So it's essential to be able to show the difference, but the precise ratio is not important and can be chosen for visual effect. (Something like 70/30 vs 30/70 is probably adequately distinct, without reducing the minor color's visibility too much. Overly-small pips of color could be problematic on a printer with poor registration.)

In my personal experience in telecom, some manufacturers use stripes, some use bands, and anyone reading the diagram should have no trouble mentally translating between the two. But it might be nice to be able to pick the visual style to match the wire in use.

There are also 3-band codes in use, for instance ICEA method 5, which is explained quite well here: https://www.buyawg.com/pdf/wire-cable-methods-of-color-coding.pdf

In this case, it's again important to differentiate the base (major) color from the tracers. (Look at wires 22 and 23 for instance.) I'm not personally experienced with this code but I've run across it in catalogs, so I don't know if there's a standard for the proportions.

myself248 avatar May 12 '21 02:05 myself248