Skip to content

Instantly share code, notes, and snippets.

View kicad_picknplace_assistant.py
#!/usr/bin/python2
import re
import os
import numpy as np
import pcbnew
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle, Circle, Ellipse, FancyBboxPatch
@JoanTheSpark
JoanTheSpark / KiCAD_CopperSpiral_v2.py
Created Nov 27, 2015
v2 with spin direction and increasing amount of segments per turn for smoother result in outer circles
View KiCAD_CopperSpiral_v2.py
import sys, os
import shutil
import math
import itertools
from copy import deepcopy
# 0 1 2 3 4 5 6
LIST_elmt = [" ("," (start ",") (end ",") "," (layer ",") ","))"]
#LIST_elmt = [" (gr_line (start 131.571908 182.314571) (end 112.874456 120.68499) (angle 90) (layer Dwgs.User) (width 0.1))"]
#LIST_elmt = [" (segment (start 118.7 106.7) (end 119.4 106.7) (width 0.25) (layer B.Cu) (net 0))"]
@JoanTheSpark
JoanTheSpark / KiCAD_CopperSpiral.py
Created Nov 26, 2015
KiCAD BZR6097, Python, Copper Track Spiral
View KiCAD_CopperSpiral.py
import sys, os
import shutil
import math
import itertools
from copy import deepcopy
# 0 1 2 3 4 5 6
LIST_elmt = [" ("," (start ",") (end ",") "," (layer ",") ","))"]
#LIST_elmt = [" (gr_line (start 131.571908 182.314571) (end 112.874456 120.68499) (angle 90) (layer Dwgs.User) (width 0.1))"]
#LIST_elmt = [" (segment (start 118.7 106.7) (end 119.4 106.7) (width 0.25) (layer B.Cu) (net 0))"]
@JoanTheSpark
JoanTheSpark / KiCAD_CopperFillPoly.py
Last active Sep 4, 2015
KiCAD 5978, Python 2.7.2, Copper Fill Polygon Drawing Script
View KiCAD_CopperFillPoly.py
import sys, os
import shutil
import math
LIST_pts = [" (polygon\n (pts\n (xy "," (filled_polygon\n (pts\n (xy ",") (xy ",")\n )\n )"]
def FNC_poly (cntr, # (x,y)
radius,
sides,
@JoanTheSpark
JoanTheSpark / KiCAD_CopperArc.py
Last active Jun 2, 2016
KiCAD 5978, Python 2.7.2, Copper Arc Drawing Script
View KiCAD_CopperArc.py
# tested in python 2.7.2
# works for KiCAD 5978 by parsing output of this script into a xyz.kicad_pcb at the right place
import sys, os
import shutil
import math
# 0 1 2 3 4 5 6
LIST_elmt = [" ("," (start ",") (end ",") "," (layer ",") ","))"]
#LIST_elmt = [" (gr_line (start 131.571908 182.314571) (end 112.874456 120.68499) (angle 90) (layer Dwgs.User) (width 0.1))"]