KiKit icon indicating copy to clipboard operation
KiKit copied to clipboard

RuntimeError: No board edges found when using PythonAPI

Open CarbonV opened this issue 8 months ago • 6 comments

Prerequisites

  • [X] I have read FAQ
  • [X] I have searched existing issues (including closed ones)
  • [X] 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.

CarbonV avatar Jun 18 '24 11:06 CarbonV