Clone part of a layout in Pcbnew.
EXAMPLE_NAME.kicad_pcb
. Edit your layout_cloner.py
to match your circuit (instructions inside the file). Run it to produce EXAMPLE_NAME_cloned.kicad_pcb
file. Open it in Pcbnew. The ratsnest may be wrong; toggle it off and on to fix.
Open Terminal and run:
python layout_cloner.py
Your system Python probably doesn't have dependency pcbnew
. Easiest to use KiCad's bundled Python, PyAlaMode.
Edit layout_cloner.py
again to make the paths absolute:
inputBoardFile = r'C:\REPLACE_WITH_PATH_TO_YOUR\EXAMPLE_NAME.kicad_pcb'
outputBoardFile = r'C:\REPLACE_WITH_PATH_TO_YOUR\EXAMPLE_NAME_cloned.kicad_pcb'
In Pcbnew, go to Tools > Scripting Console. Paste this command and press Enter.
execfile(r'C:\REPLACE_WITH_PATH_TO_YOUR\layout_cloner.py')
If you have non-ASCII characters in your path, use this command (note double backslashes). Paste and press Enter twice.
with open(u'C:\\RÉPLACE_WÍTH_PÁTH_TO_YǪÚR\\layout_cloner.py') as f: exec(f.read())