Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: No board edges found when using PythonAPI #702

Open
3 tasks done
CarbonV opened this issue Jun 18, 2024 · 6 comments
Open
3 tasks done

RuntimeError: No board edges found when using PythonAPI #702

CarbonV opened this issue Jun 18, 2024 · 6 comments

Comments

@CarbonV
Copy link

CarbonV commented Jun 18, 2024

Prerequisites

  • I have read FAQ
  • I have searched existing issues (including closed ones)
  • I use KiKit at least version 1.5.1 (older version are not supported)

KiKit version

1.5.1

KiCAD version

8.0.3

Operating system

Windows 11

Description

I have written a custom script to try and panelize with two boards. I have also run some scripts to print all the layers, Edge.Cuts layer is present and a script that checks for board edges which returns true. I assume I am not using the appendBoard function correctly.

from kikit.common import fromMm
import os

# Create a new panel
def create_panel(first_pcb, second_pcb, panel_filename):
    panel = panelize.Panel(panel_filename)

    # Absolute paths to your PCB files
    first_pcb = os.path.abspath(first_pcb)
    second_pcb = os.path.abspath(second_pcb)
    
    # Ensure the PCB files exist
    if not os.path.exists(first_pcb):
        raise FileNotFoundError(f"File not found: {first_pcb}")
    if not os.path.exists(second_pcb):
        raise FileNotFoundError(f"File not found: {second_pcb}")
    
    # Load the boards
    panel.appendBoard(first_pcb, destination=(fromMm(0), fromMm(0)))
    panel.appendBoard(second_pcb, destination=(fromMm(100), fromMm(0)))  # Change positions as needed
    # Add a frame around the panel
    panel.addFrame(5 * mm)

    # Add mouse bites for breaking the PCBs apart
    panel.addMouseBitesTabs(0.3 * mm, 1 * mm, 0.75 * mm)
    
    # Save the panel
    panel.save(panel_filename)
    print(f"Panel saved as {panel_filename}")
    
    # Save the panel
    panel.save(panel_filename)
    print(f"Panel saved as {panel_filename}")


first_pcb = PATH
second_pcb = PATH2
panel_filename = PATH3

print(f"First PCB path: {first_pcb}")
print(f"Second PCB path: {second_pcb}")

create_panel(first_pcb, second_pcb, panel_filename)

image

image

I am running from KiCad commandline.

Steps to Reproduce

Run code using KiCad commandline.

@yaqwsx
Copy link
Owner

yaqwsx commented Jun 18, 2024

Could you try adding a tolerance parameter to appendBoard, which is the size of line width of edges?

@CarbonV
Copy link
Author

CarbonV commented Jun 18, 2024

What is the unit of tolerance? When I use a tolerance of "2" it doesn't make a difference the Line Width of edges is 0.1mm.

@yaqwsx
Copy link
Owner

yaqwsx commented Jun 18, 2024

It's the default KiCAD unit - 1nm. There function fromMm and toMm. You can also import constants from kikit.units import mm and then write 1 * mm.

@CarbonV
Copy link
Author

CarbonV commented Jun 18, 2024

Adding a tolerance worked! Thank you. Could you elaborate why?

@yaqwsx
Copy link
Owner

yaqwsx commented Jun 18, 2024

It seems that some change in the history started to include the line width; we never noticed as CLI always uses some tolerance and also all my custom scripts.

@CarbonV
Copy link
Author

CarbonV commented Jun 18, 2024

Maybe it's an option to have a default tolerance in panelize.py?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants