yaqwsx / PcbDraw

Convert your KiCAD board into a nicely looking 2D drawing suitable for pinout diagrams
MIT License
1.16k stars 91 forks source link

Non-square PCBs are rendered broken #96

Closed kb-elmo closed 2 years ago

kb-elmo commented 2 years ago

When trying to render a PCB that is not a simple square and instead has multiple different angled sides PCBdraw renders most of the PCB as a transparent area.

Example:
image

Rendered file:
test_pcb.zip

yaqwsx commented 2 years ago

I suspect that your outline is not continuous and you have small gaps between the arc. PcbDraw expects a continuous outline. This is somewhat addressed in the upcoming v1 release.

kb-elmo commented 2 years ago

I think if the outline wasn't continuous it wouldn't get rendered properly in the KiCAD rendered either and throw an error instead.

But it works perfectly fine in there.

image

yaqwsx commented 2 years ago

KiCAD renderer tolerates discontinuations up to 0.1mm. This is not what we do; we expect a perfectly continuous outline at the moment. If you want to check for outline continuations, run it through KiKit ­– it will exactly tell you where the discontinuation is.

kb-elmo commented 2 years ago

Like I said there doesn't seem to be any discontinuation in the outline.

image

I added the example file to my original post btw so you can check it yourself if you don't believe me.

yaqwsx commented 2 years ago

Thank you, having the file will help me to trace the bug (I confirm it is there).

set-soft commented 2 years ago

Just my 2 cents: the edge polygon is OK, because I use PcbDraw to compose a fast print of the PCB in KiBot and I get:

3liza-assembly-front

I'm extracting the masks from the file generated by PcbDraw and then composing the result to be similar to what you get from KiCad (using print options).

JordanAceto commented 2 years ago

Hello :)

I also have been having some similar issues when the corners are not square. Below is an image of two very similar, but different boards. In an attempt to troubleshoot I copy-pasted the edge-cuts layer from the good board on the right into the bad board the left using pcb_new, but the odd behavior persisted.

My system is: KiCad 6.0.6 on Ubuntu 22.04

left_bad_right_good

Below is a zip file with two nearly identical minimal boards, as seen above. One of them draws fine and the other has that big weird triangle. Perhaps it can be used as a troubleshooting aid. I was using KiBot when I ran into the issue, and I left some convenience Make and yaml files in there.

pcbdraw_test.zip

Thanks and all the best.

set-soft commented 2 years ago

Hi @JordanAceto !

I found the problem and will be fixed in the PcbDraw that I include with KiBot. The problem is just about the tolerance in the code that joins segments, it was 5 nm and now is 1 µm. The failing case is a 52 nm error in the KiCad SVG generation (rounding issues). PcbDraw is changing a lot and I'm not sure if I'll be able to use the current git code soon.

The patch is here: https://github.com/INTI-CMNB/PcbDraw/commit/e18d42c725f691f751cef78804e9142e12e13911

JordanAceto commented 2 years ago

Hi @set-soft, what you wrote makes perfect sense. I confirm that when I apply your patch the left board from my image above prints correctly. Thank you!

set-soft commented 2 years ago

Hi @JordanAceto and @kb-elmo ! I added a new release to my fork: https://github.com/INTI-CMNB/PcbDraw/releases/tag/v0.9.0-2 including this patch. Is also uploaded it to the KiBot Debian/Ubuntu repo: https://set-soft.github.io/debian/

yaqwsx commented 2 years ago

The change was applied in 2f50ead

kb-elmo commented 2 years ago

Thanks! 😄

duckyb commented 2 years ago

@yaqwsx would it be possible to include this fix in a new release of kikit docker? I would like to have this fix in my github actions automated workflow.

yaqwsx commented 2 years ago

Note that v1 was released, which includes proper edges reconstruction. Also, the KiKit docker image already contains this new version.