diff --git a/pcbnew/python/examples/createFPC40.py b/pcbnew/python/examples/createFPC40.py index 32bde3ea59..247511a135 100644 --- a/pcbnew/python/examples/createFPC40.py +++ b/pcbnew/python/examples/createFPC40.py @@ -1,4 +1,5 @@ #!/usr/bin/env python2.7 +import os.path from pcbnew import * size_025_160mm = wxSizeMM(0.25,1.6) @@ -8,8 +9,6 @@ pads = 40 # 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("FPC"+str(pads)) # give it a reference name @@ -24,9 +23,9 @@ module.SetPosition(m_pos) def smdRectPad(module,size,pos,name): pad = D_PAD(module) pad.SetSize(size) - pad.SetShape(PAD_RECT) - pad.SetAttribute(PAD_SMD) - pad.SetLayerMask(PAD_SMD_DEFAULT_LAYERS) + pad.SetShape(PAD_SHAPE_RECT) + pad.SetAttribute(PAD_ATTRIB_SMD) + pad.SetLayerSet(pad.SMDMask()) pad.SetPos0(pos) pad.SetPadName(name) return pad @@ -45,16 +44,19 @@ e = EDGE_MODULE(module) e.SetStart0(wxPointMM(-1,0)) e.SetEnd0(wxPointMM(0,0)) e.SetWidth(FromMM(0.2)) -e.SetLayer(EDGE_LAYER) +e.SetLayer(F_SilkS) e.SetShape(S_SEGMENT) module.Add(e) -# save the PCB to disk +# save the footprint to disk fpid = LIB_ID("FPC"+str(pads)) #the name in library module.SetFPID( fpid ) -try: - FootprintLibCreate("fpc40.mod") -except: - pass # we try to create, but may be it exists already -FootprintSave("fpc40.mod",module) +lib_name = "fpc40.pretty" #lib_path is actually a path, not a file +dst_type = IO_MGR.GuessPluginTypeFromLibPath( lib_name ); +dst_plugin = IO_MGR.PluginFind( dst_type ) + +if os.path.exists(lib_name) == False: + dst_plugin.FootprintLibCreate(lib_name) + +dst_plugin.FootprintSave(lib_name,module) diff --git a/pcbnew/python/examples/listPcbLibrary.py b/pcbnew/python/examples/listPcbLibrary.py deleted file mode 100644 index 8262c17497..0000000000 --- a/pcbnew/python/examples/listPcbLibrary.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python -from pcbnew import * - -lst = FootprintEnumerate("/usr/share/kicad/modules/sockets.mod") - -for name in lst: - m = FootprintLoad("/usr/share/kicad/modules/sockets.mod",name) - print name,"->",m.GetLibRef(), m.GetReference() - - for p in m.Pads(): - print "\t",p.GetPadName(),p.GetPosition(),p.GetPos0(), p.GetOffset() -