adamws / kicad-kbplacer

KiCad plugin for automatic keyboard's key placement and routing
GNU General Public License v3.0
333 stars 23 forks source link

Unexpected behavior: diode "relative" place method rotates diodes #17

Closed 1000eyed closed 8 months ago

1000eyed commented 8 months ago

Describe the bug What it says in the title. When I use diode autoplacement relatively to the first switch-diode pair, all switches are rotated to a certain degree. I expect that diodes should remain square to switches in this case. Plugin does not crash though.

Additional context I observe this behavior on switches which are not square to the PCB drawing. I assume it is connected to the layout I am building?

Screenshots First I was like Plugin window But then diode_bug.zip

KiCad version info

Application: KiCad PCB Editor x86_64 on x86_64

Version: 7.0.9-7.0.9~ubuntu22.04.1, release build

Libraries:
    wxWidgets 3.2.1
    FreeType 2.11.1
    HarfBuzz 6.0.0
    FontConfig 2.13.1
    libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.16

Platform: Ubuntu 22.04.3 LTS, 64 bit, Little endian, wxGTK, ubuntu, x11

Build Info:
    Date: Nov  8 2023 19:01:25
    wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
    Boost: 1.74.0
    OCC: 7.5.2
    Curl: 7.88.1
    ngspice: 38
    Compiler: GCC 11.4.0 with C++ ABI 1016

Build settings:
    KICAD_SPICE=ON
adamws commented 8 months ago

it is reproducible, something is wrong with handling relative positions when elements are rotated at the beginning. I will try to fix that in the near future, in the meantime you could work around that:

  1. reset the position of first pair, place diode (but not rotated yet) image
  2. Reset rotation of diodes, with scripting console:
    import pcbnew
    b = pcbnew.GetBoard()
    for f in b.GetFootprints():
    if "D" in f.GetReference():
        f.SetOrientationDegrees(90.0)
    pcbnew.Refresh()

    image

  3. Run plugin again image
1000eyed commented 8 months ago

Thanks! 👍