yaqwsx / KiKit

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

kikit not using Kicad environment variables for worksheet path #712

Open gwideman opened 4 months ago

gwideman commented 4 months ago

Prerequisites

KiKit version

kikit, version 1.5.1

KiCAD version

8.0.3

Operating system

Windows 10 Pro 10.0.19045

Description

Kikit seems unable to interpret Kicad Environment variables for the path to the (inherited) Drawing Sheet wks file.

When running kikit, if the source PCB has its Page Settings > Drawing Sheet > File set to a path that includes an environment variable, then this will raise many message dialogs. The number of dialogs may be (rows x cols), I have not counted exactly.

(Note that in Kicad, when selecting a Drawing Sheet wks file, Kicad automatically substitutes the matching environment oath variable if there is one.)

Caveat: For path to Drawing Sheet wks files that we use, we created a "custom" Kicad path environment variable, as permitted/encouraged by the Kicad Preferences > Configure Paths dialog. I have not tried this with one of the default environment variables, image

Steps to Reproduce

  1. Create a "Drawing Sheet" directory somewhere, and create (or copy) a Drawing Sheet wks file in it.
  2. In Kicad main program > Preferences > Configure Paths, create a new environment variable pointing to the Drawing Sheet directory from step 1.
  3. Select a candidate PCB that's amenable to panelizing. Open the PCB file in Kicad, visit the File > Page Settings, and use the file selector button to navigate to the Drawing Sheet from step 1, and select it. The path returned to the File slot should contain the environment variable established in step 2. Save the file.
  4. Create and run a kikit script that inputs the PCB file from step 3, and creates a panel of say 3 x 3 boards.
  5. Run that script.
  6. Observe the numerous message dialogs complaining of not finding the wks file.