From cf09129387ba90a3077930de40a216b222456b31 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 24 Feb 2016 09:45:34 +0100 Subject: [PATCH] Python interface: add methods to add or remove layers to/from a layer set. Usefull to modify the layer set of pads Very minor other fixes. --- pcbnew/class_pad.cpp | 2 -- .../pcad2kicadpcb_plugin/examples/files.txt | 3 +++ pcbnew/scripting/pcbnew.i | 24 +++++++++++++++++++ pcbnew/scripting/plugins/PadArray.py | 6 +++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 785845f0a0..21c1b1b15f 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -110,8 +110,6 @@ LSET D_PAD::ConnSMDMask() LSET D_PAD::UnplatedHoleMask() { - // was #define PAD_ATTRIB_HOLE_NOT_PLATED_DEFAULT_LAYERS ALL_CU_LAYERS | - // SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT static LSET saved = LSET::AllCuMask() | LSET( 3, F_SilkS, B_Mask, F_Mask ); return saved; } diff --git a/pcbnew/pcad2kicadpcb_plugin/examples/files.txt b/pcbnew/pcad2kicadpcb_plugin/examples/files.txt index ca06173439..c51f52cd60 100644 --- a/pcbnew/pcad2kicadpcb_plugin/examples/files.txt +++ b/pcbnew/pcad2kicadpcb_plugin/examples/files.txt @@ -5,3 +5,6 @@ A PCAD ASCII sample file can be downloaded from http://www.pcadbegin.webtm.ru (Provided by its author Andrey Manin ) http://www.pcadbegin.webtm.ru/schetchik.php?scach=1 (CK1202_V1.pcb) + +Other sample: +http://www.firstpr.com.au/temp/kicad-bugs/P-CAD-conversion/S1000MA-1992-09-08-via-Altium-P-CAD-ASCII.pcb diff --git a/pcbnew/scripting/pcbnew.i b/pcbnew/scripting/pcbnew.i index 11af4ccba6..1e69396483 100644 --- a/pcbnew/scripting/pcbnew.i +++ b/pcbnew/scripting/pcbnew.i @@ -167,4 +167,28 @@ %include "plugins.i" %include "units.i" +// Extend LSET by 2 methods to add or remove layers from the layer list +// Mainly used to add or remove layers of a pad layer list +%extend LSET +{ + LSET addLayer( LAYER_ID aLayer) { return self->set(aLayer); } + LSET removeLayer( LAYER_ID aLayer) { return self->reset(aLayer); } + LSET addLayerSet( LSET aLayerSet) { return *self |= aLayerSet; } + LSET removeLayerSet( LSET aLayerSet) { return *self &= ~aLayerSet; } + + %pythoncode + %{ + def AddLayer(self, layer): + return self.addLayer( layer ) + + def AddLayerSet(self, layers): + return self.addLayerSet( layers ) + + def RemoveLayer(self, layer): + return self.removeLayer( layer ) + + def RemoveLayerSet(self, layers): + return self.removeLayerSet( layers ) + %} +} diff --git a/pcbnew/scripting/plugins/PadArray.py b/pcbnew/scripting/plugins/PadArray.py index 5908d38ed5..732f17bf4d 100644 --- a/pcbnew/scripting/plugins/PadArray.py +++ b/pcbnew/scripting/plugins/PadArray.py @@ -168,6 +168,12 @@ class PadGridArray(PadArray): pad.SetPadName(self.GetName(x,y)) self.AddPad(pad) +class EPADGridArray(PadGridArray): + + def NamingFunction(self, nx, ny): + return self.firstPadNum + + class PadZGridArray(PadArray):