diff --git a/examples/ex15.gv b/examples/ex15.gv index dcbe4e6..402948e 100644 --- a/examples/ex15.gv +++ b/examples/ex15.gv @@ -5,10 +5,10 @@ graph { node [fillcolor="#FFFFFF" fontname=arial height=0 margin=0 shape=none style=filled width=0] edge [fontname=arial style=bold] edge [color="#FF66CC" headclip=false style="solid,bold" tailclip=false] - X1:p1j:c -- X1:p5j:c [straight=straight] - X1:p5j:c -- X1:p7j:c [straight=straight] + X1:p1j:c -- X1:p5j:c [addPTS=.18 colorPTS="#FF66CC" straight=straight] + X1:p5j:c -- X1:p7j:c [addPTS=.18 colorPTS="#FF66CC" straight=straight] edge [color="#FF0000" headclip=false style="solid,bold" tailclip=false] - X1:p2j:c -- X1:p6j:c [straight=straight] + X1:p2j:c -- X1:p6j:c [addPTS=.18 colorPTS="#FF0000" straight=straight] edge [headclip=true style=bold tailclip=true] X1 [label=< @@ -34,14 +34,14 @@ graph { - + - + @@ -58,19 +58,19 @@ graph { - + - + - + @@ -94,10 +94,10 @@ graph {
GND 1
VCC 2
GND 5
VCC 6
GND 7
> fillcolor="#FFFFFF" shape=box style=filled] edge [color="#000000" headclip=false style="solid,bold" tailclip=false] - X2:p1j:c -- X2:p5j:c [straight=straight] - X2:p5j:c -- X2:p7j:c [straight=straight] + X2:p1j:c -- X2:p5j:c [addPTS=.18 colorPTS="#000000" straight=straight] + X2:p5j:c -- X2:p7j:c [addPTS=.18 colorPTS="#000000" straight=straight] edge [color="#000000" headclip=false style="solid,bold" tailclip=false] - X2:p2j:c -- X2:p6j:c [straight=straight] + X2:p2j:c -- X2:p6j:c [addPTS=.18 colorPTS="#000000" straight=straight] edge [headclip=true style=bold tailclip=true] X2 [label=< @@ -124,14 +124,14 @@ graph { - + - + @@ -148,19 +148,19 @@ graph { - + - + - +
1 GND
2 VCC
3
5 GND
6 VCC
7 GND
diff --git a/examples/ex15.html b/examples/ex15.html index 8e4e511..00c976c 100644 --- a/examples/ex15.html +++ b/examples/ex15.html @@ -58,7 +58,6 @@ GND - 1 @@ -66,7 +65,6 @@ VCC - 2 @@ -84,7 +82,6 @@ GND - 5 @@ -92,13 +89,11 @@ VCC - 6 GND - 7 @@ -247,7 +242,6 @@ GND - 2 @@ -255,7 +249,6 @@ VCC - 3 @@ -273,7 +266,6 @@ GND - 6 @@ -281,13 +273,11 @@ VCC - 7 GND - @@ -333,6 +323,66 @@ X2:c--X2:c + + +__CIRCLE__1 + + + + +__CIRCLE__2 + + + + +__CIRCLE__3 + + + + +__CIRCLE__4 + + + + +__CIRCLE__5 + + + + +__CIRCLE__6 + + + + +__CIRCLE__7 + + + + +__CIRCLE__8 + + + + +__CIRCLE__9 + + + + +__CIRCLE__10 + + + + +__CIRCLE__11 + + + + +__CIRCLE__12 + + diff --git a/examples/ex15.png b/examples/ex15.png index 9c3d5a1..9ec5ee9 100644 Binary files a/examples/ex15.png and b/examples/ex15.png differ diff --git a/examples/ex15.svg b/examples/ex15.svg index 56b994b..6b18f9f 100644 --- a/examples/ex15.svg +++ b/examples/ex15.svg @@ -29,7 +29,6 @@ GND - 1 @@ -37,7 +36,6 @@ VCC - 2 @@ -55,7 +53,6 @@ GND - 5 @@ -63,13 +60,11 @@ VCC - 6 GND - 7 @@ -218,7 +213,6 @@ GND - 2 @@ -226,7 +220,6 @@ VCC - 3 @@ -244,7 +237,6 @@ GND - 6 @@ -252,13 +244,11 @@ VCC - 7 GND - @@ -304,5 +294,65 @@ X2:c--X2:c + + +__CIRCLE__1 + + + + +__CIRCLE__2 + + + + +__CIRCLE__3 + + + + +__CIRCLE__4 + + + + +__CIRCLE__5 + + + + +__CIRCLE__6 + + + + +__CIRCLE__7 + + + + +__CIRCLE__8 + + + + +__CIRCLE__9 + + + + +__CIRCLE__10 + + + + +__CIRCLE__11 + + + + +__CIRCLE__12 + + diff --git a/examples/ex16.gv b/examples/ex16.gv index c679055..125e82b 100644 --- a/examples/ex16.gv +++ b/examples/ex16.gv @@ -69,10 +69,10 @@ graph { > fillcolor="#FFFFFF" shape=box style=filled] edge [color="#000000:#FF66CC:#000000"] - X1:p1r:e -- X1:p5r:e [label="X1-LO1"] - X1:p5r:e -- X1:p7r:e [label="X1-LO1"] + X1:p1r:e -- X1:p5r:e [label=" "] + X1:p5r:e -- X1:p7r:e [label=" "] edge [color="#000000:#FF0000:#0066FF:#FF8000:#A0DFFF:#000000"] - X1:p2r:e -- X1:p6r:e [label="X1-LO2"] + X1:p2r:e -- X1:p6r:e [label=" "] edge [headclip=true style=bold tailclip=true] X2 [label=< @@ -133,10 +133,10 @@ graph {
> fillcolor="#FFFFFF" shape=box style=filled] edge [color="#000000:#FF66CC:#000000"] - X2:p1l:w -- X2:p5l:w [label="X2-LO1"] - X2:p5l:w -- X2:p7l:w [label="X2-LO1"] + X2:p1l:w -- X2:p5l:w [label=" "] + X2:p5l:w -- X2:p7l:w [label=" "] edge [color="#000000:#FF66CC:#000000"] - X2:p2l:w -- X2:p6l:w [label="X2-LO2"] + X2:p2l:w -- X2:p6l:w [label=" "] edge [color="#000000:#895956:#000000"] X1:p1r:e -- W1:w1:w W1:w1:e -- X2:p1l:w diff --git a/examples/ex16.html b/examples/ex16.html index b65cd03..e9ba965 100644 --- a/examples/ex16.html +++ b/examples/ex16.html @@ -92,7 +92,7 @@ -X1-LO1 + @@ -100,7 +100,7 @@ -X1-LO1 + @@ -111,7 +111,7 @@ -X1-LO2 + @@ -293,7 +293,7 @@ -X2-LO1 + @@ -301,7 +301,7 @@ -X2-LO1 + @@ -309,7 +309,7 @@ -X2-LO2 + diff --git a/examples/ex16.png b/examples/ex16.png index ed6cd61..23c5ad8 100644 Binary files a/examples/ex16.png and b/examples/ex16.png differ diff --git a/examples/ex16.svg b/examples/ex16.svg index 050a2b4..a33c3d4 100644 --- a/examples/ex16.svg +++ b/examples/ex16.svg @@ -63,7 +63,7 @@ -X1-LO1 + @@ -71,7 +71,7 @@ -X1-LO1 + @@ -82,7 +82,7 @@ -X1-LO2 + @@ -264,7 +264,7 @@ -X2-LO1 + @@ -272,7 +272,7 @@ -X2-LO1 + @@ -280,7 +280,7 @@ -X2-LO2 + diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 4d09113..5c77cbc 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -22,6 +22,7 @@ from wireviz.DataClasses import ( Options, Tweak, Side, + Image, ) from wireviz.svgembed import embed_svg_images_file from wireviz.wv_bom import ( @@ -281,7 +282,26 @@ class Harness: shColor = shortComp.color if pinindex+1 in shortPins: - pinhtml.append(f' ') + # path = os.getcwd().replace('\\', '/') + # blackCircle = Image(src=f"{path}/images/circle_5mm_96dpi.png") # , width = 5, height = 5, fixedsize = True circle_5mm_96dpi.png + + # from cairosvg import svg2png + + # svg_code = """ + # + # + # + # + # + # """ + + # svg2png(bytestring=svg_code,write_to= f'{path}/output.png') + + # pinhtml.append(f' {html_image(blackCircle).replace("", "")}') + + pinhtml.append(f' ') + + # pinhtml.append(f' ') else: pinhtml.append(f' ') @@ -312,7 +332,9 @@ class Harness: dot.edge( f"{connector.name}:p{shortPins[i - 1]}j:c", f"{connector.name}:p{shortPins[i]}j:c", - straight="straight" + straight="straight", + addPTS=".18", + colorPTS=str(wv_colors.translate_color(shColor, "HEX")), ) dot.attr("edge", headclip="true", tailclip="true", style="bold") @@ -744,8 +766,9 @@ class Harness: def graphRender(self, type, filename, graph): if find_executable("dot") and find_executable("gvpr") and find_executable("neato"): + os.environ['GVPRPATH'] = str(Path(__file__).parent) graph.save(filename=f"{filename}_tmp.gv") - os.system(f"dot {filename}_tmp.gv | gvpr -q -cf pin2pin.gvpr | neato -n2 -T{type} -o {filename}.{type}") + os.system(f"dot {filename}_tmp.gv | gvpr -q -cf pin2pin.gvpr | neato -n2 -T{type} -o {filename}.{type}")#{':cairo'if type == 'svg' else ''} os.remove(f"{filename}_tmp.gv") else: graph.render(filename=filename) # old rendering methode, befor jumper implementations diff --git a/src/wireviz/images/circle_5mm.svg b/src/wireviz/images/circle_5mm.svg new file mode 100644 index 0000000..84abaa5 --- /dev/null +++ b/src/wireviz/images/circle_5mm.svg @@ -0,0 +1,37 @@ + + + + + + + + + + diff --git a/src/wireviz/images/circle_5mm_96dpi.png b/src/wireviz/images/circle_5mm_96dpi.png new file mode 100644 index 0000000..cf8305e Binary files /dev/null and b/src/wireviz/images/circle_5mm_96dpi.png differ diff --git a/src/wireviz/pin2pin.gvpr b/src/wireviz/pin2pin.gvpr index ab76ccf..f42d511 100644 --- a/src/wireviz/pin2pin.gvpr +++ b/src/wireviz/pin2pin.gvpr @@ -1,14 +1,17 @@ /******************************************************************* - see https://forum.graphviz.org/t/straitening-one-line-throu-a-table/2196 + see https://forum.graphviz.org/t/straitening-one-line-throu-a-table/2196 and https://forum.graphviz.org/t/way-of-drawing-a-black-circle-inside-a-table-field/2273/12 input must include pos values (must be output from one of the engines w/ -Tdot)# Thanks to steveroush and FeRDNYC *******************************************************************/ BEG_G{ double x1,y1,x2,y2,x3,y3,x4,y4; - string tok[int]; - int cnt; + string ptSize, tok[int], pt[]; + int cnt, circ, i; + node_t aNode; + + circ=0; /*************************************** $G.bb=""; @@ -31,4 +34,24 @@ E[straight] { pos=sprintf("%.3f,%.3f %.3f,%.3f %.3f,%.3f %.3f,%.3f", x1,y1, x2,y2, x3,y3, x4,y4); $.label=""; // remove pesky label $.lp=""; // remove peskier label pos + + if (hasAttr($, "addPTS") && $.addPTS!=""){ + // now we place point nodes at the edge ends + pt[1] = tok[0]; + pt[2] = tok[cnt-1]; + ptSize=$.addPTS; + for (pt[i]) { + if (i==2 && pt[1]==pt[2]) + continue; + aNode=node($G, "__CIRCLE__" + (string)++circ); + aNode.pos=pt[i]; + aNode.shape="point"; + aNode.width=ptSize; + aNode.height=ptSize; + aNode.style="filled"; + aNode.fillcolor=$.colorPTS; + aNode.color=$.colorPTS; + } + } + } \ No newline at end of file