Skip to content

Instantly share code, notes, and snippets.

@yaqwsx
Created February 22, 2022 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaqwsx/e7e4f056abc22575fb14d2e8a6695056 to your computer and use it in GitHub Desktop.
Save yaqwsx/e7e4f056abc22575fb14d2e8a6695056 to your computer and use it in GitHub Desktop.
from kikit.common import findBoardBoundingBox
# This function should be provided by KiKit, but at the moment, it is not. I
# opened an issue for that: https://github.com/yaqwsx/KiKit/issues/283.
# Basically, panel.makeGrid should take the tolerance parameter, but it doesn't
# at the moment.
def locateBoard(inputFilename, tolerance):
"""
Given a filename of the board, find the source are of it.
"""
inputBoard = pcbnew.LoadBoard(inputFilename)
return expandRect(findBoardBoundingBox(inputBoard), tolerance)
# And somewhere in the code:
substrates = panel.makeGrid(input,
sourceArea=locateBoard(input, tolerance=1 * mm),
rows=rows,
cols=cols,
destination=(100 * mm, 100 * mm),
verSpace=0, horSpace=0, rotation=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment