X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Virus-Scanned: Debian amavisd-new at mail.linetec.nl Content-Type: multipart/mixed; boundary="------------1F0P0AxgbKJSTr6dKReK8J1H" Message-ID: <6b291694-f248-aa27-aa38-732ad42096d6@linetec.nl> Date: Sun, 1 Oct 2023 22:54:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [geda-user] PCB silk layer image script To: geda-user AT delorie DOT com References: <6877754c-dcb7-db34-dd39-419de060ad7a AT linetec DOT nl> <20231001134334 DOT D3643862293F AT turkos DOT aspodata DOT se> <20231001191307 DOT 88D638622949 AT turkos DOT aspodata DOT se> Content-Language: en-US From: "Richard Rasker (rasker AT linetec DOT nl) [via geda-user AT delorie DOT com]" In-Reply-To: <20231001191307.88D638622949@turkos.aspodata.se> Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk This is a multi-part message in MIME format. --------------1F0P0AxgbKJSTr6dKReK8J1H Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Op 01-10-2023 om 21:13 schreef karl AT aspodata DOT se [via geda-user AT delorie DOT com]: > Richard Rasker: > ... >> Where is this default size stored anyway? Or is it hard-coded into pcb? > pstoedit-3.74.tar.gz is available at sourceforge. > In its src dir there are: > [snip] > > And as you can see, the board size is hardcoded in that pstoedit > plugin: > > > Perhaps the pcb plugin handles the board size better. Thanks for tracking this down! When I use pcb instead of pcbfill, two things are different: - The result now ends up at the bottom left of Layer 1 named 'poly' instead of Layer 10 named 'silk' -- which usually means it is on the top copper layer. - Polygons now have one co-ordinate per line. This would make it a bit easier to move the logo to the top left using bash, but it would probably still take me a lot of time to get it right. Also, I don't think that bash is very suitable for the job, and I'm no good at other programming languages/tools (Perl, awk) either. >>> I can help with a program doing that if you wish. >> That would be nice, although I should of course try and figure it out >> for myself first. I see that the resulting PCB file features large >> polygons, so if changing the size beforehand is not possible, I'd say >> the logical approach would be to find the lowest Y value (the topmost >> polygon point), and subtract this value from all Y values - although >> this is not something that I like to do in a bash script. > ... > > In https://aspodata.se/git/openhw/bin/, I have Common.pm, Pcb.pm and > Pcb_test.pl. I'm currently testing how to get min/max x and y for > different pcb things: > > $ Pcb_test.pl bb styrkort.pcb > via: 8.5000mm 10.0000mm 151.0000mm 222.5000mm > line: 5.8700mm 3.0000mm 154.1300mm 237.0000mm > $ Pcb_test.pl polygon styrkort.pcb > Layer 1, name top: > 5.7500mm 3.0000mm 154.0000mm 237.0000mm > Layer 2, name bottom: > 5.7500mm 3.0000mm 154.0000mm 237.0000mm > Layer 3, name outline: > Layer 4, name bottom silk: > Layer 5, name top silk: > $ I'm not sure I understand the above. From what I see, Y co-ordinates can be located using the " [0-9]+" regex (so including a leading space), starting from line 6 in the pcb logo file; the lowest value found should then be subtracted from all Y values, effectively moving the logo to the top left. Then the highest X and Y values should be determined, which then define the overall pcb size. Even though this sounds like an interesting and no doubt instructive challenge for a not-too-experienced bash programmer like me, I think I'll stick with manually adjusting the pcb logo file for now; it only takes a couple of seconds, and the layers need adjusting anyway, depending on the number of layers in the target board. After all, I only need to create logos etc. very occasionally. Thanks again for the help; attached is the latest script with an extra check if the supplied filename actually exists, plus some cleanup of intermediate files. No doubt, things can be further improved, but as mentioned before, I'm not a very proficient programmer. Regards, Richard --------------1F0P0AxgbKJSTr6dKReK8J1H Content-Type: text/plain; charset=UTF-8; name="pcbsilk" Content-Disposition: attachment; filename="pcbsilk" Content-Transfer-Encoding: base64 IyEvYmluL2Jhc2gKCmlmIFsgIiQxIiA9ICItPyIgXSB8fCBbICIkMSIgPSAiLWgiIF0gfHwg WyAiJDEiID0gIi0taGVscCIgXQp0aGVuCiAgIGVjaG8gIlVzYWdlOiAgJDAgWy1XIHdpZHRo XSBpbWFnZSIKICA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