mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
*) Extend SWIG support deeper into the BOARD class. *) Move swig *.i files into a directory identified for SWIG, in preparation for a parallel universe involving Phoenix's SIP. *) Move swig files which will be common to both eeschema and pcbnew into common/swig. *) Sketch out a "common" python module, and plan on dovetailing that into a libkicad_shared.{dll,so} *) Add common/swig/ki_exceptions.i and define a macro HANDLE_EXCEPTIONS() which is to be applied to any function which needs C++ to python exception translation. *) Move the test for SWIG tool into top level CMakeLists.txt file for use in all python modules beyond pcbnew, i.e. eeschema and common. *) Add SWIG_MODULE_pcbnew_EXTRA_DEPS which generates a better Makefile, one which rebuilds the swig generated *.cxx file when one of its dependencies change. *) Re-architect the board.i file so that it can be split into multiple *.i files easily. *) Make some KIWAY from python progress, in preparation for Modular KiCad phase III.
49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
#!/usr/bin/env python2.7
|
|
from pcbnew import *
|
|
|
|
size_0_6mm = wxSizeMM(0.6,0.6)
|
|
size_1_0mm = wxSizeMM(1.0,1.0)
|
|
|
|
# create a blank board
|
|
pcb = BOARD()
|
|
|
|
pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
|
|
|
|
# create a new module, it's parent is our previously created pcb
|
|
module = MODULE(pcb)
|
|
module.SetReference("M1") # give it a reference name
|
|
module.Reference().SetPos0(wxPointMM(-10,-10))
|
|
pcb.Add(module) # add it to our pcb
|
|
m_pos = wxPointMM(50,50)
|
|
module.SetPosition(m_pos)
|
|
|
|
# create a pad array and add it to the module
|
|
n = 1
|
|
for y in range (0,10):
|
|
for x in range (0,10):
|
|
pad = D_PAD(module)
|
|
pad.SetDrillSize(size_0_6mm)
|
|
pad.SetSize(size_1_0mm)
|
|
pt = wxPointMM(1.27*x,1.27*y)
|
|
pad.SetPos0(pt);
|
|
#pad.SetPosition(pt)
|
|
pad.SetPadName(str(n))
|
|
module.Add(pad)
|
|
n+=1
|
|
|
|
|
|
# save the PCB to disk
|
|
pcb.Save("my2.kicad_pcb")
|
|
pcb.Save("my2.brd")
|
|
|
|
pcb = LoadBoard("my2.kicad_pcb")
|
|
|
|
print map( lambda x: x.GetReference() , list(pcb.GetModules()))
|
|
|
|
for m in pcb.GetModules():
|
|
for p in m.Pads():
|
|
print p.GetPadName(), p.GetPosition(), p.GetOffset()
|
|
|
|
|
|
# pcb.GetDesignSettings()
|