Mail Archives: geda-user/2023/10/02/14:16:36
This is a multi-part message in MIME format.
--------------YM2Il2nUVFfgxs6PHEj09sVc
Content-Type: multipart/alternative;
boundary="------------cLqUDeq4d3uuV8jYmnR3fx4R"
--------------cLqUDeq4d3uuV8jYmnR3fx4R
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hello Karl,
Op 02-10-2023 om 17:47 schreef karl AT aspodata DOT se [via geda-user AT delorie DOT com]:
> Richard Rasker:
>> Op 02-10-2023 om 00:35 schreefkarl AT aspodata DOT se [viageda-user AT delorie DOT com]:
> ...
> Well I did use a very large width and the result
> grow past the board size:
> ./pcbsilk -W 1204mm TestLogo.jpg
OK, that'll be the problem then,
>> Anyway, I might give it
>> a shot using grep, cut, sed and sort to manipulate the X and Y values --
>> even though I think it's going to be pretty inefficient.
> You don't need to.
Well, I already came up with this oneliner for the minimum y value from
the pcb logo file:
ymin=`egrep "\[[0-9]+\ [0-9]+\]" $silkname.pcb | cut -d " " -f2 |
cut -d "]" -f1 | sort -n | head -1`
> Below I made a 60mm wide logo, its minimum y extent was 220.4103mm.
Yup, that seems right:
echo $ymin -> *867757*
yshift= echo 'scale=2;-$ymin*25.4/100000' | bc
echo $yshift -> *-220.41*
> Then I rerun pstoedit but told it to move the result
> 220mm up:
>
> $ ./pcbsilk -W 60mm TestLogo.jpg
> $ Pcb_test.pl polygon TestLogo.pcb
> Layer 1, name poly:
> 0.0000 220.4103mm 59.9996mm 279.0472mm
> Layer 10, name silk:
> $ pstoedit -q -f "pcb:-mm -tshifty -220" TestLogo.eps TestLogo.pcb
And unfortunately, this is where things go wrong. It works just fine
with the numerical value:
$ pstoedit -q -f "pcb:-mm -tshifty -220.41" -ssp TestLogo.eps TestLogo.pcb
But when I replace -220.41 with the variable $yshift calculated above,
it no longer works; also see line 88 of the attached script version. It
appears that $yshift is not expanded, even though double quote marks
were used.
> $ Pcb_test.pl polygon TestLogo.pcb
> Layer 1, name poly:
> 0.0000 0.4102mm 59.9996mm 59.0471mm
> Layer 10, name silk:
> $
>
> The only thing remaining is to edit the file, removing the empty
> layer and rename layer 1 to something like: Layer(5 "top silk" "silk").
Yes, I already fixed the layers, and I also created an extra command
line switch to select the number of layers, with a default of 2, which
causes top silk to end up on layer 6. The X size is now also correct, so
all that still needs to be done is shift the logo to the top. Once
everything works, the extra echo commands for $ymin and $yshift can be
commented out, and removing the intermediate files can be restored.
Best regards,
Richard Rasker
--------------cLqUDeq4d3uuV8jYmnR3fx4R
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello Karl,<br>
</p>
<div class="moz-cite-prefix">Op 02-10-2023 om 17:47 schreef
<a class="moz-txt-link-abbreviated" href="mailto:karl AT aspodata DOT se">karl AT aspodata DOT se</a> [via <a class="moz-txt-link-abbreviated" href="mailto:geda-user AT delorie DOT com">geda-user AT delorie DOT com</a>]:<br>
</div>
<blockquote type="cite"
cite="mid:20231002154748 DOT BA848862295E AT turkos DOT aspodata DOT se">
<pre class="moz-quote-pre" wrap="">Richard Rasker:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Op 02-10-2023 om 00:35 schreef <a class="moz-txt-link-abbreviated" href="mailto:karl AT aspodata DOT se">karl AT aspodata DOT se</a> [via <a class="moz-txt-link-abbreviated" href="mailto:geda-user AT delorie DOT com">geda-user AT delorie DOT com</a>]:
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">...
Well I did use a very large width and the result
grow past the board size:
./pcbsilk -W 1204mm TestLogo.jpg </pre>
</blockquote>
OK, that'll be the problem then,
<blockquote type="cite"
cite="mid:20231002154748 DOT BA848862295E AT turkos DOT aspodata DOT se">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Anyway, I might give it
a shot using grep, cut, sed and sort to manipulate the X and Y values --
even though I think it's going to be pretty inefficient.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
You don't need to. </pre>
</blockquote>
<p>Well, I already came up with this oneliner for the minimum y
value from the pcb logo file:</p>
<blockquote>
<p><font face="monospace">ymin=`egrep "\[[0-9]+\ [0-9]+\]"
$silkname.pcb | cut -d " " -f2 | cut -d "]" -f1 | sort -n |
head -1`</font><br>
</p>
</blockquote>
<blockquote type="cite"
cite="mid:20231002154748 DOT BA848862295E AT turkos DOT aspodata DOT se">
<pre class="moz-quote-pre" wrap="">Below I made a 60mm wide logo, its minimum y extent was 220.4103mm.</pre>
</blockquote>
<p>Yup, that seems right:<br>
</p>
<blockquote>
<p><font face="monospace">echo $ymin -> </font><font
face="monospace"><span style="font-family:monospace"><b><span
style="color:#000000;background-color:#ffffff;">867757</span></b><br>
</span>yshift= echo 'scale=2;-$ymin*25.4/100000' | bc<br>
echo $yshift -> <b>-220.41</b> </font></p>
</blockquote>
<blockquote type="cite"
cite="mid:20231002154748 DOT BA848862295E AT turkos DOT aspodata DOT se">
<pre class="moz-quote-pre" wrap=""> Then I rerun pstoedit but told it to move the result
220mm up:
$ ./pcbsilk -W 60mm TestLogo.jpg
$ Pcb_test.pl polygon TestLogo.pcb
Layer 1, name poly:
0.0000 220.4103mm 59.9996mm 279.0472mm
Layer 10, name silk:
$ pstoedit -q -f "pcb:-mm -tshifty -220" TestLogo.eps TestLogo.pcb </pre>
</blockquote>
<p>And unfortunately, this is where things go wrong. It works just
fine with the numerical value:<br>
</p>
<blockquote>
<pre class="moz-quote-pre" wrap="">$ pstoedit -q -f "pcb:-mm -tshifty -220.41" -ssp TestLogo.eps TestLogo.pcb </pre>
</blockquote>
<p></p>
<p>But when I replace -220.41 with the variable $yshift calculated
above, it no longer works; also see line 88 of the attached script
version. It appears that $yshift is not expanded, even though
double quote marks were used.<br>
</p>
<blockquote type="cite"
cite="mid:20231002154748 DOT BA848862295E AT turkos DOT aspodata DOT se">
<pre class="moz-quote-pre" wrap="">$ Pcb_test.pl polygon TestLogo.pcb
Layer 1, name poly:
0.0000 0.4102mm 59.9996mm 59.0471mm
Layer 10, name silk:
$
The only thing remaining is to edit the file, removing the empty
layer and rename layer 1 to something like: Layer(5 "top silk" "silk").</pre>
</blockquote>
<p>Yes, I already fixed the layers, and I also created an extra
command line switch to select the number of layers, with a default
of 2, which causes top silk to end up on layer 6. The X size is
now also correct, so all that still needs to be done is shift the
logo to the top. Once everything works, the extra echo commands
for $ymin and $yshift can be commented out, and removing the
intermediate files can be restored.<br>
</p>
<p>Best regards,</p>
<p>Richard Rasker<br>
</p>
</body>
</html>
--------------cLqUDeq4d3uuV8jYmnR3fx4R--
--------------YM2Il2nUVFfgxs6PHEj09sVc
Content-Type: text/plain; charset=UTF-8; name="pcbsilk"
Content-Disposition: attachment; filename="pcbsilk"
Content-Transfer-Encoding: base64
IyEvYmluL2Jhc2gKCmlmIFsgIiQxIiA9ICItPyIgXSB8fCBbICIkMSIgPSAiLWgiIF0gfHwg
WyAiJDEiID0gIi0taGVscCIgXQp0aGVuCiAgIGVjaG8gIlVzYWdlOiAgJDAgWy1XIHdpZHRo
XSBbLUwgbGF5ZXJzXSBpbWFnZSIKICAgZWNobyAtZSAiXHRJbWFnZSBpcyBhbnkgaW1hZ2Ug
ZmlsZSBvciBFUFMgZmlsZSIKICAgZWNobyAtZSAiXHRVc2UgLVcgc3dpdGNoIHRvIHNwZWNp
Znkgd2lkdGgiCiAgIGVjaG8gLWUgIlx0V2lkdGggaXMgc3BlY2lmaWVkIGluIGluY2hlcyAo
c3VmZml4Om5vbmUgb3IgaW4pIG9yIG1pbGxpbWV0ZXJzIChzdWZmaXg6IG1tKSIKICAgZWNo
byAtZSAiXHREZWZhdWx0IHdpZHRoIGlzIDQwIG1tIgogICBlY2hvIC1lICJcdE51bWJlciBv
ZiBsYXllcnMgc2hvdWxkIG1hdGNoIHRhcmdldCBwY2IiCiAgIGVjaG8gLWUgIlx0RGVmYXVs
dCBudW1iZXIgb2YgbGF5ZXJzIGlzIDIiCiAgIGV4aXQgMApmaQoKIyBIYW5kbGUgY29tbWFu
ZCBsaW5lIHN3aXRjaGVzCgpjYXNlICIkMSIgaW4KICAgICItTCIpCiAgICAgICAgbGF5ZXJz
PSQyCiAgICAgICAgaWYgWyAiJDMiID0gIi1XIiBdCiAgICAgICAgdGhlbgogICAgICAgICAg
ICB3aWR0aD0kNAogICAgICAgICAgICBpbWFnZWZpbGU9JDUKICAgICAgICBlbHNlCiAgICAg
ICAgICAgIGltYWdlZmlsZT0kMwogICAgICAgICAgICB3aWR0aD00MG1tCiAgICAgICAgZmkK
ICAgICAgICA7OwogICAgIi1XIikKICAgICAgICB3aWR0aD0kMgogICAgICAgIGlmIFsgIiQz
IiA9ICItTCIgXQogICAgICAgIHRoZW4KICAgICAgICAgICAgbGF5ZXJzPSQ0CiAgICAgICAg
ICAgIGltYWdlZmlsZT0kNQogICAgICAgIGVsc2UKICAgICAgICAgICAgaW1hZ2VmaWxlPSQz
CiAgICAgICAgICAgIGxheWVycz0yCiAgICAgICAgZmkKICAgICAgICA7OwogICAgKikKICAg
ICAgICBpbWFnZWZpbGU9JDEKICAgICAgICBsYXllcnM9MgogICAgICAgIHdpZHRoPTQwbW0K
ICAgICAgICA7Owplc2FjCgojIFRvcCBzaWxrc2NyZWVuIGxheWVyIGlzIGZvdW5kIGF0IE4r
NApzaWxrbGF5ZXI9JCgobGF5ZXJzICsgNCkpCgojIGVjaG8gIldpZHRoOiAgJHdpZHRoIgoj
IGVjaG8gIkxheWVyczogJGxheWVycyIKIyBlY2hvICJTaWxrOiAgIExheWVyICRzaWxrbGF5
ZXIiCiMgZWNobyAiSW1hZ2U6ICAkaW1hZ2VmaWxlIgoKIyBDaGVjayBpZiBpbnB1dCBmaWxl
IGV4aXN0cywgZXhpdCBpZiBpdCBkb2Vzbid0CmlmICEgWyAtZiAkaW1hZ2VmaWxlIF0KdGhl
bgogICAgZWNobyAiRmlsZSBub3QgZm91bmQsIGV4aXRpbmciCiAgICBleGl0IDEKZmkKCmV4
dGVuc2lvbj0iJHtpbWFnZWZpbGUjIyoufSI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