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.
This commit is contained in:
jean-pierre charras 2016-02-24 09:45:34 +01:00
parent bedf0b6aec
commit cf09129387
4 changed files with 33 additions and 2 deletions

View File

@ -110,8 +110,6 @@ LSET D_PAD::ConnSMDMask()
LSET D_PAD::UnplatedHoleMask() 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 ); static LSET saved = LSET::AllCuMask() | LSET( 3, F_SilkS, B_Mask, F_Mask );
return saved; return saved;
} }

View File

@ -5,3 +5,6 @@ A PCAD ASCII sample file can be downloaded from http://www.pcadbegin.webtm.ru
(Provided by its author Andrey Manin <pcadbegin[at]rambler.ru>) (Provided by its author Andrey Manin <pcadbegin[at]rambler.ru>)
http://www.pcadbegin.webtm.ru/schetchik.php?scach=1 (CK1202_V1.pcb) 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

View File

@ -167,4 +167,28 @@
%include "plugins.i" %include "plugins.i"
%include "units.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 )
%}
}

View File

@ -168,6 +168,12 @@ class PadGridArray(PadArray):
pad.SetPadName(self.GetName(x,y)) pad.SetPadName(self.GetName(x,y))
self.AddPad(pad) self.AddPad(pad)
class EPADGridArray(PadGridArray):
def NamingFunction(self, nx, ny):
return self.firstPadNum
class PadZGridArray(PadArray): class PadZGridArray(PadArray):