yaqwsx / KiKit

Automation tools for KiCAD
https://yaqwsx.github.io/KiKit
MIT License
1.49k stars 200 forks source link

kikit crash when trying to panelized PCB #694

Open kfirmaymon84 opened 3 months ago

kfirmaymon84 commented 3 months ago

Prerequisites

KiKit version

1.5.1

KiCAD version

8.0.2

Operating system

Windows 11

Description

Hi, When I run kikit panelize, Screenshot 2024-05-22 143250

the "Running kikit widows freeze, Screenshot 2024-05-22 143304

after a couple of secoud, I got a message "Kicad PCB Editor 8.0.2 is not responding" Screenshot 2024-05-22 143332

if I close the program and open the PCB file I can see that the file is been penalized.

if I run kikit from CLI everything runs ok,

Steps to Reproduce

Just penalize PCB. EvoAcs_SideTouchSens.zip

thisisgregm commented 2 months ago

Could be related to this issue: https://github.com/yaqwsx/KiKit/issues/678 See my comment here: https://github.com/yaqwsx/KiKit/issues/678#issuecomment-2094349259 I can see you use anchor: tl, the same as I did to reproduce my issue. No problems with other options for anchor.

kfirmaymon84 commented 2 months ago

Dident help, I tried to do only panelized and it also happened. Screenshot 2024-06-20 104223

yaqwsx commented 1 month ago

@kfirmaymon84: Could you try the upstream version? I am able to panelize the board with the upstream version of KiKit. So I would like to rule the possibility this issue is caused by your setup (e.g., Windows or dependencies mismatch).

JeremiahGillis commented 1 month ago

I am on Windows 11, KiCad 8.0.4, and KiKit 1.6.0. I can confirm that the GUI will lock up and eventually close.

image

I switched to the CLI and discovered another issue. The output kicad_pcb file will be blank if text is enabled and the anchor is set to tl. The output file works correctly when the anchor is set other points such as mt or tr.

I went back to the GUI and turned my text off, but KiCad will still lock up and eventually close.

I also see that KiKit now requires an output file in the GUI. If I set this to the currently opened file since I want the panel to show up like previous KiKit versions, KiCad will crash quickly after the "Running kikit" dialog opens. If I set the output file to something new, not opened, KiCad takes awhile to lockup an crash during panelization.

Since there is an output option in the GUI now, are you moving away from panelizating the currently opened file? IE You want to panelize the current open board?

Here is my JSON file:

{
    "layout": {
        "rows": "5",
        "cols": "2"
    },
    "source": {
        "tolerance": "10mm"
    },
    "tabs": {
        "type": "full"
    },
    "cuts": {
        "type": "vcuts"
    },
    "framing": {
        "type": "railslr",
        "hspace": "0mm"
    },
    "tooling": {
        "type": "4hole",
        "hoffset": "2.5mm",
        "voffset": "5mm",
        "size": "2mm"
    },
    "fiducials": {
        "type": "4fid",
        "hoffset": "2.5mm",
        "voffset": "10mm",
        "opening": "2mm"
    },
    "text": {
        "type": "simple",
        "hoffset": "2.5mm",
        "voffset": "140mm",
        "orientation": "90deg",
        "text": "JLCJLCJLCJLC",
        "anchor": "tl"
    },
    "page": {
        "type": "A2",
        "posx": "200mm",
        "posy": "50mm"
    }
}
yaqwsx commented 1 month ago

Since there is an output option in the GUI now, are you moving away from panelizating the currently opened file? IE You want to panelize the current open board?

No, the whole point of GUI existence is that people can quickly preview the panel and iterate to get the desired shape. PcbNew is used as a live preview of the panel. When you are satisfied with the result, you should get the penalization JSON and put it in your makefile or CI or another automated pipeline for building production files. GUI was never meant as a way of preparing manufacturing files. Unless something significantly changes in KiCAD, it will never be. KiCAD API is limited, and there are numerous aspects of the PCB we cannot modify via the API (e.g., sheet size, custom DRC rules, rules violation exclusions etc.). Therefore, KiKit parses and modifies the board, project, and schematic files. These changes cannot be brought to the "live view" provided by PcbNew. So when you save the board from preview, all of these features are missing, and the panels are not passing DRC or have other defects.

However, people insisted on saving the preview and using it for production. They were constantly reporting, "Hey, the panel from the GUI does not pass DRC!". Hence, I introduced the output file parameter in GUI in v1.6.0 to make them happy. They can use the GUI, they see live preview and they also get a file that is not damaged.

Back to the original issue, can you confirm that in v1.6.0:

So far, I struggle to reproduce the issue you report on both of my machines running Ubuntu 22.04 and Windows 11. The board panelizes just fine.

Is it possible that you output the panel to a network location? Or to a location handled by OneDrive cloud sync?

JeremiahGillis commented 1 month ago

Back to the original issue, can you confirm that in v1.6.0:

  • the file panelizes just fine and in a reasonable time in CLI?
  • the panel takes forever/crashes in GUI?

Yes, I just panelized four projects. My most complex only took 5 seconds. Like I mentioned before, the panel will be blank though if text is enabled and the anchor point is set to tl.

KiCad will crash with the exact same JSON file used in the CLI through the GUI.

Is it possible that you output the panel to a network location? Or to a location handled by OneDrive cloud sync?

My project is local, both the input and out, OneDrive is disabled. My local storage is a PCIe 4.0 NVMe.

I've spent some time this morning to see how I can help you replicate this. The GUI crashes for me with your basic example conn.kicad_pcb while using CLI command works fine.

CLI:

kikit panelize^
    --layout "rows: 2; cols: 2" ^
    --tabs "type: full" ^
    --cuts "type: vcuts" ^
    "C:\Users\jerem\Downloads\KiKit-master\LocalTest\conn.kicad_pcb" "C:\Users\jerem\Downloads\KiKit-master\LocalTest\panel.kicad_pcb"

GUI: KiKit Crash Sample Board 07212024

I have uninstalled KiCad 7.0.10, 8.0.4, and deleted the KiCad folder from my Documents which stores the plugins. After a fresh install of only 8.0.4, installing only the KiKit plug in and the backend, the sample above still crashes in the GUI.

Backend install log:

Successfully installed PrettyTable-0.7.2 PyMeta3-0.5.1 click-8.1.7 colorama-0.4.6 commentjson-0.9.0 euclid3-0.1 kikit-1.6.0 lark-parser-0.7.8 markdown2-2.5.0 pcbnewTransition-0.4.1 ply-3.11 pybars3-0.9.7 pypng-0.0.19 shapely-2.0.5 solidpython-1.1.3

Windows Info:

OS Name: Microsoft Windows 11 Pro
Version: 10.0.22631 Build 22631
Processor: AMD Ryzen 9 5950X 16-Core Processor, 3401 Mhz, 16 Core(s), 32 Logical Processor(s)
Installed Physical Memory (RAM): 64.0 GB
GPU: Nvidia RTX 3090, Driver Version 555.99

I have another Windows 11 and Windows 10 computer that I will test on and report back within the next day.

JeremiahGillis commented 1 month ago

I have the exact same behavior on my Windows 11 laptop. It works just fine in the CLI but not the GUI.

image

OS Name: Microsoft Windows 11 Pro
Version: 10.0.22631 Build 22631
Processor: 13th Gen Intel(R) Core(TM) i9-13900HX, 2200 Mhz, 24 Core(s), 32 Logical Processor(s)
Installed Physical Memory (RAM): 64.0 GB
GPU: Nvidia RTX 4090, Driver Version 556.12
JeremiahGillis commented 1 month ago

My Windows 10 machine failed the first attempt, but worked every subsequent attempt. I went back to one of my Windows 11 machines for more testing via the GUI.

  1. The progress bar will not move and KiCad will crash with your repo conn.kicad_pcb file.
  2. If the conn.kicad_pcb file is opened, a dialog will prompt about different fills from previous KiCad version. If this is acknowledged, then saved for KiCad 8 format, KiKit panelization behavior is different. Now, KiCad will output a panel file correctly, the progress bar will move a little bit, then KiCad will hang and eventually crash. KiCad will not update the open file with a live preview of the panel. The panels settings are the same ones I used in the top of my post yesterday.
  3. I went back to Windows 10 following Step 2 and it still panelizes correctly in the GUI. However, if I try one of my private boards with my JSON file, it will act just like Windows 11 in Step 2. It will output a panel file correctly but lock up afterwards.

If it would help, I could create a private repo and invite you. Then you could try a problem layout file with my json config. You would need to delete this files once you were done testing. Just let me know if that would help.